注意:
- 直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致
- 单次设置的数据不能超过1024kB,请尽量避免一次设置过多的数据。
Page({ /** * 页面的初始数据 */ data: { title:null, descTime:null, descAdress:null, headerImg:null, sihe:{ headerImg:'../../images/detail/sihe.jpg', title:'北京四合院之美', address:'北京海淀', time:'2018/10/1' }, gsw: { headerImg: '../../images/detail/q.jpg', title: '贵霜王朝的艺术', address: '无锡新梅路81号', time: '2018/10/1' } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var param = options.id; var showInfo = this.data[param]; this.setData({ title: showInfo.title, address: showInfo.address, headerImg: showInfo.headerImg }) }})微信小程序













