对比:Vue-2.3v-model原理-CSDN博客
v-model为:modelValue和@update:modelValue的简写
表单类组件封装
父组件
<ChannelSelect v-model="cateId"></ChannelSelect>
子组件
<script setup>
defineProps({modelValue: {type: [Number, String]}
})const emit = defineEmits(['update:modelValue'])
</script>
<template><el-select:modelValue="modelValue"@update:modelValue="emit('update:modelValue', $event)"></el-select>
</template>