当前位置:网站首页>Wechat applet: click the event to obtain the current device information (basic)
Wechat applet: click the event to obtain the current device information (basic)
2022-06-13 06:08:00 【HaanLen】
Bind event to get current device information
pages/study/index.wxml
<!--pages/study/index.wxml-->
<text>pages/study/index.wxml</text>
<view>{
{text}}</view>
<button type="primary" bindtap="getInfo"> Click for information </button>
pages/study/index.ts
// pages/study/index.ts
Page({
/** * Initial data of the page */
data: {
text: ''
},
/** * Life cycle function -- Monitor page loading */
onLoad() {
},
/** * Life cycle function -- Listening page first rendering completed */
onReady() {
},
/** * Life cycle function -- Monitor page display */
onShow() {
},
/** * Life cycle function -- Monitor page hidden */
onHide() {
},
/** * Life cycle function -- Monitor page uninstall */
onUnload() {
},
/** * Page related event handler -- Monitor user pull-down action */
onPullDownRefresh() {
},
/** * Handling function of page pull bottom event */
onReachBottom() {
},
/** * Users click the upper right corner to share */
onShareAppMessage() {
},
getInfo() {
wx.getSystemInfo({
success: (res) => {
console.log('res', res);
let str = ` equipment :${
res?.model}, platform :${
res?.platform}`
this.setData({
text: str
})
}
})
}
})
Return information
{
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
}



Real machine debugging 
边栏推荐
- Minimum spanning tree (prim+kruskal) learning notes (template +oj topic)
- Test logiciel - résumé des FAQ d'interface
- Leetcode Timo attack - simple
- Self summarizing
- Security baseline check script - the road to dream
- Regular verification of mobile phone number, landline email ID card
- 软件测试——接口常见问题汇总
- Alibaba cloud OSS file download cannot be resumed at a breakpoint
- 軟件測試——接口常見問題匯總
- Fragment lifecycle
猜你喜欢

超有范的 logo 在线设计制作工具

Experience of redis installation under Linux system (an error is reported at the same time. The struct redis server does not have a member named XXXX)

Fichier local second Search Tool everything
![[spark]spark introductory practical series_ 8_ Spark_ Mllib (lower)__ Machine learning library sparkmllib practice](/img/65/a214d137e230b1a1190feb03660f2c.jpg)
[spark]spark introductory practical series_ 8_ Spark_ Mllib (lower)__ Machine learning library sparkmllib practice

Tongweb card, tongweb card, tongweb card

Echart折线图:当多条折线存在相同name,图例仍全部显示

Test logiciel - résumé des FAQ d'interface
![[turn] explain awk (2)_ Combining formatted output with built-in variables to realize requirements](/img/65/a214d137e230b1a1190feb03660f2c.jpg)
[turn] explain awk (2)_ Combining formatted output with built-in variables to realize requirements

Echart柱状图:echart实现堆叠柱状图

Pod libwebp error reporting solution
随机推荐
Echart line chart: multiple line charts show only one line at a time
Let's talk about how ArrayList is dynamically resized and what kind of mechanism is it?
Leetcode- intersection of two arrays ii- simple
Uni app dynamic setting title
Waterfall flow layout of uni app Homepage
軟件測試——接口常見問題匯總
Tongweb card, tongweb card, tongweb card
Local file search tool everything
php 分布式事务 原理详解
Leetcode Hamming distance simple
Power of leetcode-4 - simple
HBuilderX:HBuilderX安装以及其常用插件安装
Alibaba cloud OSS file download cannot be resumed at a breakpoint
Fichier local second Search Tool everything
Leetcode- hex number - simple
Leetcode- reverse string - simple
Leetcode guessing numbers game - simple
Leetcode- maximum average of subarray i- simple
Leetcode- minimum number of operations to make array elements equal - simple
Introduction to USB learning (I) -- Dongfeng night flower tree