feat: getSystemInfoSyncc
parent
6a4ee92619
commit
7a67079c08
|
@ -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: {}
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue