0
点赞
收藏
分享

微信扫一扫

微信小程序开发之——获取系统信息,2021阿里、网易、京东等大厂最新Android面试题

兵部尚输 2022-01-31 阅读 72

用户字体大小

{{result.fontSizeSetting}}

客户端基础库版本

{{result.SDKVersion}}

设备性能等级

{{result.benchmarkLevel}}

设备方向

{{result.deviceOrientation}}

允许微信使用相册

{{result.albumAuthorized}}

允许微信使用摄像头

{{result.cameraAuthorized}}

允许微信
使用定位

{{result.locationAuthorized}}

允许微信使用麦克风

{{result.microphoneAuthorized}}

允许微信通知

{{result.notificationAuthorized}}

微信通知带有提醒

{{result.notificationAlertAuthorized}}

微信通知带有标记

{{result.notificationBadgeAuthorized}}

微信通知带有声音

{{result.notificationSoundAuthorized}}

微信使用日历

{{result.phoneCalendarAuthorized}}

蓝牙开关

{{result.bluetoothEnabled}}

地理位置开关

{{result.locationEnabled}}

Wi-Fi开关

{{result.wifiEnabled}}

系统当前主题

{{result.theme}}

3.2 样式文件(systemInfo.wxss)

/* pages/systemInfo/systemInfo.wxss */

.table{

border: 1px solid orange;

font-size: 40rpx;

font-family: ‘Franklin Gothic Medium’, ‘Arial Narrow’, Arial, sans-serif;

}

.tr{

display: flex;

width: 100%;

justify-content: center;

height: 2rem;

align-items: center;

}

.th{

width: 50%;

display: flex;

justify-content: center;

align-items: center;

background: #3366ff;

color: #fff;

height: 2rem;

border-right: 1px black solid;

}

.th:last-child{

border-right: none;

}

.td{

width: 50%;

display: flex;

justify-content: center;

align-items: center;

text-align: center;

height: 2rem;

border-right: 1px black solid;

border-bottom: 1px black solid;

}

.td:last-child{

border-right: none;

}

3.3 逻辑文件

// pages/systemInfo/systemInfo.js

Page({

/**

  • 生命周期函数–监听页面加载

*/

onLoad: function (options) {

wx.getSystemInfo({

success: (result) => {

this.setData({

result

})

console.log(result)

},

fail:err=>{

console.log(“信息获取失败”)

}

})

},

})

3.4 systemInfo.json

/systemInfo/systemInfo.js

Page({

/**

  • 生命周期函数–监听页面加载

*/

onLoad: function (options) {

wx.getSystemInfo({

success: (result) => {

this.setData({

result

})

console.log(result)

},

fail:err=>{

console.log(“信息获取失败”)

}

})

},

})

3.4 systemInfo.json

举报

相关推荐

0 条评论