图书馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
463 B

// utils/global.js
export function waitLibcodeReady(){
return new Promise((resolve)=>{
const app = getApp()
if(app.globalData.libcode){
return resolve(app.globalData.libcode)
}
// 轮询等待,最多3秒
let count = 0
const timer = setInterval(()=>{
count++
if(app.globalData.libcode || count>30){
clearInterval(timer)
resolve(app.globalData.libcode || '')
}
},100)
})
}