Commit 65eb89b7 authored by leiqingsong's avatar leiqingsong

修改接口执行顺序

parent 526414ca
...@@ -112,16 +112,20 @@ class bridgeToAppFun { ...@@ -112,16 +112,20 @@ class bridgeToAppFun {
if (this.userAgent === "android") { if (this.userAgent === "android") {
console.log("an"); console.log("an");
version = window.android.getAppVersion(); version = window.android.getAppVersion();
return version;
} else { } else {
console.log("ios获取版本号"); console.log("ios获取版本号");
jsBridge.callhandler("getAppVersion", null, response => { return new Promise((resolve, reject) => {
if (response) { jsBridge.callhandler("getAppVersion", null, response => {
console.log("版本号,获取到的数据", response); if (response) {
version = response; console.log("版本号,获取到的数据", response);
} resolve(response);
} else {
reject("ios获取版本号失败");
}
});
}); });
} }
return version;
} }
} }
......
...@@ -123,7 +123,13 @@ export default { ...@@ -123,7 +123,13 @@ export default {
}, },
async getAppVersion() { async getAppVersion() {
console.log("设置里获取到的版本号", this.$bridgeToAppFun.getAppVersion()); console.log("设置里获取到的版本号", this.$bridgeToAppFun.getAppVersion());
this.version = "版本" + (await this.$bridgeToAppFun.getAppVersion()); if (this.$bridgeToAppFun.userAgent === "ios") {
this.$bridgeToAppFun.getAppVersion().then(res => {
this.version = "版本" + res;
});
} else {
this.version = "版本" + this.$bridgeToAppFun.getAppVersion();
}
}, },
getUser() { getUser() {
const params = { const params = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment