<template>
<div>
<el-input v-model="inputValue" v-bind="options"></el-input>
</div>
</template>
<script>
import {defineComponent, ref, watchEffect} from 'vue';
import {ElInput} from "element-plus";
export default defineComponent({
name: 'FsInput',
components: { ElInput },
props: {
modelValue: {
type: [String,Number],
default: ''
},
options: {
type: Object,
default: () => ({})
}
},
emits: ['update:modelValue'],
setup(props, { emit }) {
const inputValue = ref(props.modelValue);
watchEffect(() => {
emit('update:modelValue', inputValue.value);
});
return {
inputValue
};
}
});
</script>
感觉跟直接调用差不多
可能是从架构层级考虑 想做一整套(配置化)自定义的组件库吧 方便拓展