feat: getSystemInfoSyncc

master
limin 2020-12-08 10:38:16 +08:00 committed by XuPeng
parent 6a4ee92619
commit 7a67079c08
2 changed files with 26 additions and 1 deletions

View File

@ -12,5 +12,28 @@ Page({
})
}
})
}
},
getSystemInfoSync() {
const that = this;
try {
const res = wx.getSystemInfoSync()
console.log(res.model)
console.log(res.pixelRatio)
console.log(res.windowWidth)
console.log(res.windowHeight)
console.log(res.language)
console.log(res.version)
console.log(res.platform)
that.setData({
systemInfo: res
});
} catch (e) {
// Do something when catch error
}
},
clearInfo() {
this.setData({
systemInfo: {}
})
},
})

View File

@ -67,6 +67,8 @@
</view>
<view class="btn-area">
<button type="primary" bindtap="getSystemInfo">获取手机系统信息</button>
<button type="primary" bindtap="getSystemInfoSync">同步获取手机系统信息</button>
<button bindtap="clearInfo">清空</button>
</view>
</view>
</view>