vue3自定义v-model
在自定义父亲组件上:
<MyComponent v-model:myValue="doubleBind" />
在子组件内:
<script setup lang="ts">
function onInput(e: Event) {
const target = e.target as HTMLInputElement
emit('update:myValue', target.value)
}
</script>
在自定义父亲组件上:
<MyComponent v-model:myValue="doubleBind" />
在子组件内:
<script setup lang="ts">
function onInput(e: Event) {
const target = e.target as HTMLInputElement
emit('update:myValue', target.value)
}
</script>