|
|
const serverDownloadMixin = {
|
|
|
methods: {
|
|
|
isDownloadBarHide() {
|
|
|
async isDownloadBarHide() {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -8,8 +8,39 @@ const serverDownloadMixin = { |
|
|
|
|
|
const clientDownloadMixin = {
|
|
|
methods: {
|
|
|
isDownloadBarHide() {
|
|
|
async isDownloadBarHide() {
|
|
|
let isMiniapp = await this.isMiniapp();
|
|
|
|
|
|
if (isMiniapp) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
return document.getElementById('no-download');
|
|
|
},
|
|
|
|
|
|
isMiniapp() {
|
|
|
// 因为不在微信环境里面,这个接口回调不返回,因此做了一个 race,强制返回值
|
|
|
return Promise.race([new Promise((resolve) => {
|
|
|
if (/micromessenger/i.test(navigator.userAgent)) {
|
|
|
/* eslint-disable-next-line */
|
|
|
wx.miniProgram.getEnv((res) => {
|
|
|
console.log(res);
|
|
|
if (res.miniprogram) {
|
|
|
resolve(true);
|
|
|
} else {
|
|
|
resolve(false);
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
resolve(false);
|
|
|
}
|
|
|
}), this.sleep(3000).then(() => false)]);
|
|
|
},
|
|
|
|
|
|
sleep(ns) {
|
|
|
return new Promise(resolve => {
|
|
|
setTimeout(resolve, ns);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|