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

用户字体大小

{{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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值