UNPKG

mt-ui-components-vue3

Version:

玛果添实UI组件库(Vue3)

61 lines 2.14 kB
/* Analyzed bindings: { "name": "props", "value": "props", "FormItem": "setup-maybe-ref", "CheckButton": "setup-maybe-ref", "ref": "setup-const", "watch": "setup-const", "props": "setup-reactive-const", "emit": "setup-const", "myValue": "setup-ref", "change": "setup-const" } */ import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue"; import { FormItem, CheckButton } from '../../../components'; import { ref, watch } from 'vue'; const __sfc_main__ = { props: { name: { type: [String, Array], default: 'type', }, value: { type: String, default: undefined, }, }, emits: ['update:value'], setup(__props, { emit }) { const props = __props; const myValue = ref(props.value); const change = () => { emit('update:value', myValue.value); }; watch(() => props.value, () => { myValue.value = props.value; }, { immediate: true }); return (_ctx, _cache) => { return (_openBlock(), _createBlock(_unref(FormItem), { label: "文件类型", required: "", name: __props.name, rules: [{ required: true, message: '请选择文件类型' }] }, { default: _withCtx(() => [ _createVNode(_unref(CheckButton), { value: myValue.value, "onUpdate:value": _cache[0] || (_cache[0] = $event => ((myValue).value = $event)), options: [ { label: 'URL', value: 'url' }, { label: 'Base64', value: 'base64' }, { label: 'binary', value: 'binary' }, ], onChange: change }, null, 8 /* PROPS */, ["value"]) ]), _: 1 /* STABLE */ }, 8 /* PROPS */, ["name"])); }; } }; export default __sfc_main__;