@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
32 lines (27 loc) • 771 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
require('../../../constants/index.js');
var event = require('../../../constants/event.js');
const useRadio = (props, emit) => {
const model = vue.computed({
get: () => props.modelValue,
set: () => {
emit(event.UPDATE_MODEL_EVENT, props.value);
}
});
const { disabled, loading } = vue.toRefs(props);
const isDisabled = vue.computed(() => disabled.value || loading.value);
const checked = vue.computed(() => props.modelValue === props.value);
const focus = vue.ref(false);
return {
focus,
disabled,
isDisabled,
checked,
loading,
model
};
};
exports.useRadio = useRadio;
//# sourceMappingURL=use-radio.js.map