父组件:
<childComp v-model="aaa" /> <script> ... data() { return { aaa: 123 } } ... </script>
自定义组件:
childComp.vue <script> ... props: { modelValue: { type: Number, default: 999 }, }, data() { return { newVal: 0, } }, methods: { fun() { this.$emit('update:modelValue', this.newVal) } } ... </script>
标签:...,vue,自定义,newVal,组件,model,modelValue From: https://www.cnblogs.com/myflowers/p/17206272.html