mt-ui-components-vue3
Version:
玛果添实UI组件库(Vue3)
45 lines • 1.48 kB
JavaScript
/* Analyzed bindings: {
"value": "props",
"CheckButton": "setup-maybe-ref",
"ref": "setup-const",
"watch": "setup-const",
"props": "setup-reactive-const",
"emit": "setup-const",
"myValue": "setup-ref",
"change": "setup-const"
} */
import { defineComponent as _defineComponent } from 'vue';
import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock } from "vue";
import { CheckButton } from '../../../components';
import { ref, watch } from 'vue';
const __sfc_main__ = _defineComponent({
props: {
value: {
type: String,
default: undefined,
},
},
emits: ['update:value'],
setup(__props, { emit }) {
const props = __props;
const myValue = ref();
const change = () => {
emit('update:value', myValue.value);
};
watch(() => props.value, () => {
myValue.value = props.value;
});
return (_ctx, _cache) => {
return (_openBlock(), _createBlock(_unref(CheckButton), {
value: myValue.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => ((myValue).value = $event)),
options: [
{ label: '仅单选', value: false },
{ label: '支持多选', value: true },
],
onChange: change
}, null, 8 /* PROPS */, ["value"]));
};
}
});
export default __sfc_main__;