import wepy from 'wepy'
app.untilGetCache = (key, callback) => {
var cache = wepy.getStorageSync(key)
if (cache) {
callback(cache)
} else {
setTimeout(() => {
app.untilGetCache(key, callback)
}, 100)
}
}
export default app
存放位置
使用时
import app from '@/utils/app';
使用方法 tabBar是我缓存中的数据
app.untilGetCache('tabBar', () => {
拿到进行下一步操作
记得渲染数据时加
this.$apply()
})