上面的是app.js的全局变量
A页面自己也创建了个变量叫productList 在A页面页面显示事件中 将app.js中的productList 赋值给A页面的productList
当A页面中的productList 变量更新的时候 为什么app.js中的productList 也变了
我想当A页面中的productList 变后app.js中的productList 不变 但是我需要获取app.js里的productList 变量
已经排查过不是变量名重复的问题
上面的是app.js的全局变量
A页面自己也创建了个变量叫productList 在A页面页面显示事件中 将app.js中的productList 赋值给A页面的productList
当A页面中的productList 变量更新的时候 为什么app.js中的productList 也变了
我想当A页面中的productList 变后app.js中的productList 不变 但是我需要获取app.js里的productList 变量
已经排查过不是变量名重复的问题
2 个回答
做一次深复制
this.data.productList = [...app.globalData.productList]