当前位置:网站首页>微信小程序:点击事件获取当前设备信息(基础)
微信小程序:点击事件获取当前设备信息(基础)
2022-06-13 06:04:00 【HaanLen】
绑定事件获取当前设备信息
pages/study/index.wxml
<!--pages/study/index.wxml-->
<text>pages/study/index.wxml</text>
<view>{
{text}}</view>
<button type="primary" bindtap="getInfo">点击获取信息</button>
pages/study/index.ts
// pages/study/index.ts
Page({
/** * 页面的初始数据 */
data: {
text: ''
},
/** * 生命周期函数--监听页面加载 */
onLoad() {
},
/** * 生命周期函数--监听页面初次渲染完成 */
onReady() {
},
/** * 生命周期函数--监听页面显示 */
onShow() {
},
/** * 生命周期函数--监听页面隐藏 */
onHide() {
},
/** * 生命周期函数--监听页面卸载 */
onUnload() {
},
/** * 页面相关事件处理函数--监听用户下拉动作 */
onPullDownRefresh() {
},
/** * 页面上拉触底事件的处理函数 */
onReachBottom() {
},
/** * 用户点击右上角分享 */
onShareAppMessage() {
},
getInfo() {
wx.getSystemInfo({
success: (res) => {
console.log('res', res);
let str = `设备:${
res?.model}, 平台:${
res?.platform}`
this.setData({
text: str
})
}
})
}
})
返回信息
{
SDKVersion: "2.22.1"
batteryLevel: 0
benchmarkLevel: 1
bluetoothEnabled: true
brand: "devtools"
cameraAuthorized: true
deviceOrientation: "portrait"
devicePixelRatio: 3
enableDebug: false
errMsg: "getSystemInfo:ok"
fontSizeSetting: 16
language: "zh_CN"
locationAuthorized: true
locationEnabled: true
microphoneAuthorized: true
mode: "default"
model: "iPhone 6/7/8 Plus"
notificationAuthorized: true
pixelRatio: 3
platform: "devtools"
safeArea: {
top: 20, left: 0, right: 414, bottom: 736, width: 414, …}
screenHeight: 736
screenWidth: 414
statusBarHeight: 20
system: "iOS 10.0.1"
version: "8.0.5"
wifiEnabled: true
windowHeight: 624
windowWidth: 414
}



真机调试
边栏推荐
- AUTOSAR actual combat tutorial pdf version
- 高迸发解决方案2
- Misunderstanding of tongweb due to ease of use
- 零拷贝技术
- 18 flowable task manualtask and receivetask
- Leetcode- divide candy - simple
- 为什么那么多人讨厌A-Spice
- Etcd fast cluster building
- SPI primary key generation strategy for shardingsphere JDBC
- 2021-11-04 implementation of binary search
猜你喜欢

2 first experience of drools
![[spark]spark introductory practical series_ 8_ Spark_ Mllib (upper)__ Introduction to machine learning and sparkmllib](/img/39/501b9b8962b03cfc59e2636f88ee93.jpg)
[spark]spark introductory practical series_ 8_ Spark_ Mllib (upper)__ Introduction to machine learning and sparkmllib

自我总结ing

USB debugging assistant

13 cancelendevent of a flowable end event and compensationthrowing of a compensation event

Building a stand-alone version of Nacos series

Four shardingsphere JDBC sharding strategies

18 flowable task manualtask and receivetask

The Boys x PUBGMOBILE 联动火热来袭!来看最新游戏海报

php 分布式事务 原理详解
随机推荐
php 分布式事务 原理详解
CORS request principle
安全基线检查脚本—— 筑梦之路
3. Postman easy to use
Leetcode longest harmonic subsequence simple
Leetcode- number of maximum consecutive ones - simple
Essays on November 5, 2021
2021.9.29 learning log restful architecture
OpenGL马赛克(八)
Pod libwebp error reporting solution
What happens when the MySQL union index ABC encounters a "comparison operator"?
2021.9.29学习日志-MIME类型
Audio stereo to mono (Audio Dual Channel to mono channel)
USB debugging assistant 20181018 (v1.3)
Leetcode- detect uppercase letters - simple
Power of leetcode-4 - simple
Find out the missing numbers from the natural numbers arranged in order from 0 to 100, and the solution provides
Leetcode- longest continuous increasing sequence - simple
Tongweb adapts to openrasp
零拷贝技术