Closed likeyoukang closed 11 months ago
https://github.com/vuejs/pinia
我在store中定义了一个数组,const collectPoolList = ref<CollectPoolVo[]>([]); 当我在action中给数组重新赋值后,collectPoolList 会丢失响应式, collectPoolList.value = res.data 而我使用 collectPoolList.value.splice(0, collectPoolList.value.length, ...res.data);则不会丢失响应式 数组所有重新赋值都会丢失响应式,我想问一下这是否算是一个bug.
各个依赖版本 "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.0", "vant": "^4.4.1", "vue": "^3.3.4", "vue-router": "^4.2.5",
数组重新赋值响应式不丢失
数组重新赋值响应式丢失
No response
Please follow the instructions for bug reports. Namely add a repro using the playground
Reproduction
https://github.com/vuejs/pinia
Steps to reproduce the bug
我在store中定义了一个数组,const collectPoolList = ref<CollectPoolVo[]>([]); 当我在action中给数组重新赋值后,collectPoolList 会丢失响应式, collectPoolList.value = res.data 而我使用 collectPoolList.value.splice(0, collectPoolList.value.length, ...res.data);则不会丢失响应式 数组所有重新赋值都会丢失响应式,我想问一下这是否算是一个bug.
各个依赖版本 "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.0", "vant": "^4.4.1", "vue": "^3.3.4", "vue-router": "^4.2.5",
Expected behavior
数组重新赋值响应式不丢失
Actual behavior
数组重新赋值响应式丢失
Additional information
No response