提交 9cf1a96e 编写于 作者: Dcloud_UNI_yuhe's avatar Dcloud_UNI_yuhe 提交者: fxy060608

fix: 修复 getSystemInfo 警告 替换为具体的 API

上级 88ded457
...@@ -40,14 +40,8 @@ ...@@ -40,14 +40,8 @@
} }
let globalScreenHeight = 0 let globalScreenHeight = 0
try { try {
// #ifdef MP-WEIXIN globalScreenHeight = uni.getWindowInfo().screenHeight
globalScreenHeight = uni.getWindowInfo().screenHeight
// #endif
// #ifndef MP-WEIXIN
globalScreenHeight = uni.getSystemInfoSync().screenHeight
// #endif
} catch (e) { } catch (e) {
// 兼容本地测试 // 兼容本地测试
console.error(e) console.error(e)
...@@ -129,4 +123,4 @@ ...@@ -129,4 +123,4 @@
.uni-pd { .uni-pd {
padding-left: 15px; padding-left: 15px;
} }
</style> </style>
...@@ -44,12 +44,7 @@ ...@@ -44,12 +44,7 @@
}, },
}, },
onLoad() { onLoad() {
// #ifdef MP-WEIXIN this.platform = uni.getDeviceInfo().platform as string
this.platform = uni.getDeviceInfo().platform
// #endif
// #ifndef MP-WEIXIN
this.platform = uni.getSystemInfoSync().platform
// #endif
}, },
onUnload() { onUnload() {
uni.hideLoading() uni.hideLoading()
......
...@@ -45,12 +45,7 @@ ...@@ -45,12 +45,7 @@
}, },
}, },
onLoad() { onLoad() {
// #ifdef MP-WEIXIN this.platform = uni.getDeviceInfo().platform as string
this.platform = uni.getDeviceInfo().platform
// #endif
// #ifndef MP-WEIXIN
this.platform = uni.getSystemInfoSync().platform
// #endif
}, },
onUnload() { onUnload() {
uni.closeSocket({ uni.closeSocket({
......
...@@ -71,15 +71,8 @@ ...@@ -71,15 +71,8 @@
leftWinActive() : string { leftWinActive() : string {
return state.leftWinActive.slice(1) return state.leftWinActive.slice(1)
}, },
windowWidth() : number { windowWidth() : number {
let windowWidth = 0 return uni.getWindowInfo().windowWidth
// #ifdef MP-WEIXIN
windowWidth = uni.getWindowInfo().windowWidth
// #endif
// #ifndef MP-WEIXIN
windowWidth = uni.getSystemInfoSync().windowWidth
// #endif
return windowWidth
} }
}, },
methods: { methods: {
......
...@@ -53,18 +53,8 @@ ...@@ -53,18 +53,8 @@
} }
}, },
mounted() { mounted() {
// #ifdef MP-WEIXIN
screenWidth = uni.getWindowInfo().screenWidth screenWidth = uni.getWindowInfo().screenWidth
screenHeight = uni.getWindowInfo().screenHeight; screenHeight = uni.getWindowInfo().screenHeight;
// #endif
// #ifndef MP-WEIXIN
uni.getSystemInfo({
success: (e) => {
screenWidth = e.screenWidth;
screenHeight = e.screenHeight;
}
})
// #endif
// TODO 需要延迟设置才能生效 // TODO 需要延迟设置才能生效
setTimeout(() => { setTimeout(() => {
......
...@@ -49,11 +49,8 @@ ...@@ -49,11 +49,8 @@
} }
}, },
onLoad() { onLoad() {
// #ifdef MP-WEIXIN // #ifdef APP || MP
this.statusBarHeight = uni.getWindowInfo().statusBarHeight; this.statusBarHeight = uni.getWindowInfo().statusBarHeight;
// #endif
// #ifndef MP-WEIXIN || WEB
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
// #endif // #endif
this.nviBarHeight = NAVIBARHEIGHT + this.statusBarHeight; this.nviBarHeight = NAVIBARHEIGHT + this.statusBarHeight;
......
...@@ -92,15 +92,8 @@ ...@@ -92,15 +92,8 @@
this.doPlay(0); this.doPlay(0);
//App端适配不同状态栏高度 //App端适配不同状态栏高度
let backElement = this.$refs['back'] as UniElement; let backElement = this.$refs['back'] as UniElement;
// #endif
// #ifdef MP-WEIXIN
backElement.style.setProperty('top', uni.getWindowInfo().statusBarHeight+'px'); backElement.style.setProperty('top', uni.getWindowInfo().statusBarHeight+'px');
// #endif // #endif
// #ifndef MP-WEIXIN || WEB
backElement.style.setProperty('top', uni.getSystemInfoSync().statusBarHeight+'px');
// #endif
}, },
onShow() { onShow() {
currentPageIsShow = true currentPageIsShow = true
......
...@@ -832,12 +832,7 @@ ...@@ -832,12 +832,7 @@
modeCom() : string { modeCom() : string {
let mode = this.mode as string; let mode = this.mode as string;
if (mode != "") return mode; if (mode != "") return mode;
// #ifdef MP-WEIXIN
let systemInfo = uni.getDeviceInfo(); let systemInfo = uni.getDeviceInfo();
// #endif
// #ifndef MP-WEIXIN
let systemInfo = uni.getSystemInfoSync();
// #endif
return systemInfo.deviceType == "pc" ? "pc" : "mobile"; return systemInfo.deviceType == "pc" ? "pc" : "mobile";
}, },
totalFeeCom() : number { totalFeeCom() : number {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册