wx.setBackgroundFetchToken({
token:"bb36fc0f6a7b3757d427cce8941290"
})
if(wx.canIUse('getBackgroundFetchData')){
wx.getBackgroundFetchData({
fetchType: 'periodic',
success(res) {
that.globalData.cityjson=res.fetchedData;
wx.setStorageSync('yzscityjson', res.fetchedData)
},
fail(res){
wx.request({
url: 'https://cdn.nucarf.cn/xgb/v1.0/yzs_cities.json?v=0.1',
success(res){
that.globalData.cityjson=res.data;
wx.setStorageSync('yzscityjson', res.data)
}
})
}
});
}else{
wx.request({
url: 'https://cdn.nucarf.cn/xgb/v1.0/yzs_cities.json?v=0.1',
success(res){
that.globalData.cityjson=res.data;
wx.setStorageSync('yzscityjson', res.data)
}
})
我在APP onLaunch 里面配置的这个,用于周期性拉取地址json 页面调用,现在存在异步问题,而且周期性拉取用户第一次进入是拉取不到的,这个是怎么用的