小程序
小游戏
企业微信
微信支付
扫描小程序码分享
上面的是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]
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
做一次深复制
this.data.productList = [...app.globalData.productList]