A页面获取app.js里的全局变量后想更新A页面的变量 不想更新app.js的变量 要怎么写?

发布于 7 年前作者 rwei4859 次浏览最后编辑 7 年前来自 ask

上面的是app.js的全局变量

A页面自己也创建了个变量叫productList 在A页面页面显示事件中 将app.js中的productList 赋值给A页面的productList

当A页面中的productList 变量更新的时候 为什么app.js中的productList 也变了

我想当A页面中的productList 变后app.js中的productList 不变 但是我需要获取app.js里的productList 变量

已经排查过不是变量名重复的问题

1 回复
xiulanxiong
xiulanxiong1 楼5 年前

this.data.productList = […app.globalData.productList]