vue3学习笔记五:v-model使用
作者:互联网
1、VmodelTest.vue
<template>
<div @click="$emit('update:modelValue',modelValue+1)">counter:{{ modelValue }}</div>
</template>
<script>
export default {
props: {
modelValue: {
type: Number,
default: 1,
},
},
};
</script>
2、use.vue
<template>
<VmodeTest v-model="count"></VmodeTest>
</template>
<script>
import {
ref,
} from "vue";
export default {
setup() {
const count = ref(1)
return { count };
},
}
};
标签:count,vue,default,modelValue,笔记,export,vue3,model,ref 来源: https://blog.csdn.net/weixin_43837268/article/details/121443706