【vue3+ts】清空/重置reactive
1.reactive定义对象const test = reactive({})Object.assign(test, {})2.数组清空const test = reactive([])test.length = 0
·
1.定义对象 const test = reactive({name: 'test'})
(1)使用Object.assign
Object.assign(test, {})
要是里面有键值对的话,也会全部没有
(2)重新赋值
test = reactive({})
2.定义数组const test = reactive([])
(1)直接定义长度等于0
test.length = 0
更多推荐
已为社区贡献1条内容
所有评论(0)