UNPKG

mt-ui-components-vue3

Version:

玛果添实UI组件库(Vue3)

65 lines 2.27 kB
/* Analyzed bindings: { "value": "props", "name": "props", "ref": "setup-const", "watch": "setup-const", "FormItem": "setup-maybe-ref", "AutoComplete": "setup-maybe-ref", "props": "setup-reactive-const", "emit": "setup-const", "options": "setup-const", "date": "setup-ref", "change": "setup-const" } */ import { defineComponent as _defineComponent } from 'vue'; import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue"; import { ref, watch } from 'vue'; import { FormItem, AutoComplete } from '../../../components'; const __sfc_main__ = _defineComponent({ props: { value: { type: String, default: undefined, }, name: { type: String, default: 'format', }, }, emits: ['update:value'], setup(__props, { emit }) { const props = __props; const options = [ { label: 'yy-mm-dd hh:mm:ss', value: 'yy-mm-dd hh:mm:ss' }, { label: 'yy-mm-dd', value: 'yy-mm-dd' }, { label: 'hh:mm:ss', value: 'hh:mm:ss' }, ]; const date = ref(props.value); const change = (v) => { console.log(v, date.value); emit('update:value', date.value); }; watch(() => props.value, () => { date.value = props.value; }, { immediate: true }); return (_ctx, _cache) => { return (_openBlock(), _createBlock(_unref(FormItem), { label: "时间格式", name: __props.name }, { default: _withCtx(() => [ _createVNode(_unref(AutoComplete), { value: date.value, "onUpdate:value": _cache[0] || (_cache[0] = ($event) => ((date).value = $event)), options: options, mode: "tags", placeholder: "请选择时间格式", onChange: change }, null, 8 /* PROPS */, ["value"]) ]), _: 1 /* STABLE */ }, 8 /* PROPS */, ["name"])); }; } }); export default __sfc_main__;