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

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

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