小程序onShow
/** * 生命周期函数--监听页面加载 */onLoad: function(options) { let that = this; const openid = app.globalData.openid || Storage.get().openid; initNoPage(this, [{ api: "getPerson", inData: { openid }, outDataName: "user_data" }])}
数据只加载一次。
/** * 生命周期函数--监听页面显示 */onShow: function(options) { let that = this; const openid = app.globalData.openid || Storage.get().openid; initNoPage(this, [{ api: "getPerson", inData: { openid }, outDataName: "user_data" }])}页面每访问一次都调用一次接口。
当页面数据要求及时变化的时候,可以把接口数据放入onShow中。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

