vue3+ts
1.页面属性值
ps:vue3中ref和reactive的区别:https://www.cnblogs.com/theblogs/p/16965285.html
const searchValue = ref<string>("hhhh");//与页面html双向绑定
const searchValue: string = "哈哈哈";//无法双向绑定
2.props
defineProps 只能在 < setup> 中使用,无需导入
const props = defineProps({
isShowCheckBox: {
type: Boolean, // 参数类型
default: false, //默认值
required: false, //是否必传
},
tableData: {
type: Array, // 参数类型
default: function () {
return []
},
//默认值
required: true, //是否必传
},
});

文章详细对比了Vue3中的ref和reactive在处理页面属性值时的不同,指出了ref适用于双向绑定,而reactive创建的响应式对象无法直接用于v-model。同时,介绍了defineProps的使用方法,说明它只能在<setup>中定义,并提供了props定义示例,包括参数类型、默认值和是否必需。
815

被折叠的 条评论
为什么被折叠?



