Commit 9c52f620 by 展昭

js error

parent 0da9632e
Showing with 36 additions and 38 deletions
......@@ -46,6 +46,39 @@ Vue.prototype.setPageNavState = function () {
console.log("setPageNavState来自 ios/android的回传数据: ", response);
}
);
window.WebViewJavascriptBridge.callHandler(
"getBarHeight",
null,
function (response) {
console.log(
"main getBarHeight来自 ios/android的回传数据: ",
response
);
if (response) {
response = JSON.parse(response);
const barHeight = response.statusBarHeight;
localStorage.setItem("barHeight", barHeight);
const conHeight = 46 + barHeight;
console.log("main barHeight=", barHeight);
const dom = document.getElementsByClassName("iosStyle")[0];
if (dom) {
dom.setAttribute(
"style",
"padding-top:" + barHeight + "px !important"
);
}
const dom2 = document.getElementsByClassName("container")[0];
if (dom) {
dom2.setAttribute(
"style",
"padding-top:" + conHeight + "px !important"
);
}
}
}
);
});
} catch (err) {
console.log("main setPageNavState is error,err=", err);
......
......@@ -160,6 +160,7 @@ import { TabHeader } from "@/components";
import * as utils from "../../utils/common";
import { mapGetters, mapActions } from "vuex";
import initJsBridge from "../../assets/js/JsBridge";
import setBarHeight from "../../assets/js/setBarHeight.js";
import dayjs from "dayjs";
export default {
......@@ -167,7 +168,7 @@ export default {
[Icon.name]: Icon,
TabHeader
},
mixins: [setBarHeight],
data() {
return {
title: "人事服务",
......@@ -418,42 +419,6 @@ export default {
}
}
},
setBarHeight() {
initJsBridge(() => {
window.WebViewJavascriptBridge.callHandler(
"getBarHeight",
null,
function(response) {
console.log(
"billindex getBarHeight来自 ios/android的回传数据: ",
response
);
if (response) {
response = JSON.parse(response);
const barHeight = response.statusBarHeight;
localStorage.setItem("barHeight", barHeight);
const conHeight = 46 + barHeight;
console.log("billindex barHeight=", barHeight);
const dom = document.getElementsByClassName("iosStyle")[0];
if (dom) {
dom.setAttribute(
"style",
"padding-top:" + barHeight + "px !important"
);
}
const dom2 = document.getElementsByClassName("container")[0];
if (dom) {
dom2.setAttribute(
"style",
"padding-top:" + conHeight + "px !important"
);
}
}
}
);
});
},
closeWebView() {
try {
window.WebViewJavascriptBridge.callHandler(
......@@ -473,7 +438,7 @@ export default {
},
async mounted() {
this.setPageNavState();
this.setBarHeight();
this.globalNavLeftArrowClick(this.navLeftArrowClick);
await this.loadPeriodData();
this.payUrl = await this.loadPayUrl();
......
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 sign in to comment