UNPKG

mt-ui-components-vue3

Version:

玛果添实UI组件库(Vue3)

59 lines 2.01 kB
/* Analyzed bindings: { "value": "props", "name": "props", "ref": "setup-const", "watch": "setup-const", "FormItem": "setup-maybe-ref", "InputNumber": "setup-maybe-ref", "props": "setup-reactive-const", "emit": "setup-const", "maxLength": "setup-ref", "change": "setup-const" } */ 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, InputNumber } from '../../../components'; const __sfc_main__ = { props: { value: { type: Number, default: undefined, }, name: { type: String, default: 'maxLength', }, }, emits: ['update:value'], setup(__props, { emit }) { const props = __props; const maxLength = ref(0); const change = () => { emit('update:value', maxLength.value); }; watch(() => props.value, () => { maxLength.value = props.value; }, { immediate: true }); return (_ctx, _cache) => { return (_openBlock(), _createBlock(_unref(FormItem), { label: "最大长度", name: __props.name }, { default: _withCtx(() => [ _createVNode(_unref(InputNumber), { value: maxLength.value, "onUpdate:value": _cache[0] || (_cache[0] = $event => ((maxLength).value = $event)), style: { "width": "100%" }, precision: 0, min: 0, max: 9999, placeholder: "请输入0-9999以内的整数", onChange: change }, null, 8 /* PROPS */, ["value"]) ]), _: 1 /* STABLE */ }, 8 /* PROPS */, ["name"])); }; } }; export default __sfc_main__;