以下两种对父组件传过来的数据,在这个案例种处理有什么不同,第二种方法是不是更简洁些,直接遍历即可,效果一样?为什么要用 ref 重新处理一遍?
const props = defineProps({
itemList: {
type: Array,
},
});
const itemList = ref(props.itemList);
defineProps({
itemList: {
type: Array,
},
});
小程序、 Vue3、Uni、NodeJs,全新300+技术点,实现跨端全栈应用
了解课程