关于onload之后setdata不能赋值

发布于 6 年前作者 luxiuying12866 次浏览最后编辑 6 年前来自 ask
  • 当前 Bug 的表现(可附上截图)

  • 预期表现

  • 复现路径

  • 提供一个最简复现 Demo

data: {

details:{},

},

/**

  * 生命周期函数–监听页面加载

  */

onLoad: function (options) {

var that = this;

console.log('receive -> ' + options.current);  //打印出来是json字符串

let receive = JSON.parse(options.current);

console.log('receive -> ' + receive.image);//打印出来是字符串

that.setData({

details: receive

})

console.log('details -> ' + receive.file); //出错details is not defined;

},

求解,找了很多地方都没有办法处理这个问题,请问有热心人士能够帮忙解决一下。

2 回复
xdong
xdong1 楼6 年前

请问解决了吗

xiongxiuying
xiongxiuying2 楼4 年前

请问解决了吗