当前位置:网站首页>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
边栏推荐
猜你喜欢
Source code analysis of ArrayList
Software testing - Summary of common interface problems
Feel the power of shardingsphere JDBC through the demo
A glimpse of [wechat applet]
Function and application scenario of field setaccessible() method
Echart line chart: multiple line charts show only one line at a time
SPI primary key generation strategy for shardingsphere JDBC
Rk3399 hid gadget configuration
不在以下合法域名列表中,微信小程序解决办法
Four shardingsphere JDBC sharding strategies
随机推荐
Leetcode- maximum average of subarray i- simple
Class conflicts caused by tongweb Enterprise Edition and embedded Edition
Regular verification of mobile phone number, landline email ID card
Shardingsphere JDBC exception: no table route info
Data conversion analysis tool
Security baseline check script - the road to dream
超有范的 logo 在线设计制作工具
How to view APK version number from apk
Leetcode fizz buzz simple
php redis 制作高迸发秒杀
Cmake add -fpic option GCC
[spark]spark introductory practical series_ 8_ Spark_ Mllib (lower)__ Machine learning library sparkmllib practice
Introduction to USB learning (I) -- Dongfeng night flower tree
Leetcode- reverse vowels in string - simple
Echart histogram: X-axis displays value, Y-axis displays category
软件测试——接口常见问题汇总
AI实现亲人“复活”|老照片修复|老照片上色,免费APP推荐
USB debugging assistant 20181018 (v1.3)
Conf/tongweb Functions of properties
Audio stereo to mono (Audio Dual Channel to mono channel)