关于onload之后setdata不能赋值
发布于 4 年前 作者 luxiuying 12605 次浏览 来自 问答
  • 当前 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 回复

请问解决了吗

请问解决了吗

回到顶部