vue3 reactive不能直接赋值

vue3使用proxy,对于对象和数组都不能直接整个赋值。

数组可以 

res.forEach(e => {
    arr.push(e);
  });
或者
const state = reactive({
  arr: []
});

state.arr = [1, 2, 3]
arr.push(...res);

或.......

如果需要清空数组
arr.length = 0
 
原文地址:https://www.cnblogs.com/zhaoyun4122/p/14540540.html