1、界面展示【使用滑動(dòng)選擇器控制手機(jī)屏幕亮度】

2、關(guān)鍵代碼
1)、WXML代碼
來自CODE的代碼片
snippet_file_0.txt
2)、JS代碼
1
2
3
4
5
6
7
|
Page({
changeScreenLight:function(e){
wx.setScreenBrightness({
value: parseFloat(e.detail.value).toFixed(1)
})
}
})
|
來自CODE的代碼片
snippet_file_0.js
3、源代碼獲取方式
百度云鏈接:http://pan.baidu.com/s/1dFiVT1R
1、調(diào)節(jié)手機(jī)屏幕亮度效果展示:

2、關(guān)鍵代碼
1)WXML文件
1
|
<view bindlongtap="phoneNumTap">{{phoneNum}}</view>
|
來自CODE的代碼片
snippet_file_0.txt
2)JS文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
Page({
data:{
phoneNum:'12345678901'//測(cè)試用的號(hào)碼,并非真實(shí)號(hào)碼
},
// 長按號(hào)碼響應(yīng)函數(shù)
phoneNumTap:function(){
var that=this;
// 提示呼叫號(hào)碼還是將號(hào)碼添加到手機(jī)通訊錄
wx.showActionSheet({
itemList: ['呼叫','添加聯(lián)系人'],
success:function(res){
if(res.tapIndex===0){
// 呼叫號(hào)碼
wx.makePhoneCall({
phoneNumber: that.data.phoneNum,
})
}else if(res.tapIndex==1){
// 添加到手機(jī)通訊錄
wx.addPhoneContact({
firstName: 'test',//聯(lián)系人姓名
mobilePhoneNumber: that.data.phoneNum,//聯(lián)系人手機(jī)號(hào)
})
}
}
})
}
})
|
來自CODE的代碼片
snippet_file_0.js
3)WXSS文件
1
2
3
4
5
|
view{
color: blue;
padding: 15px;
border-bottom: 1px solid gainsboro;
}
|
來自CODE的代碼片
snippet_file_0.txt
3、源碼獲取方式
百度云鏈接:http://pan.baidu.com/s/1gfzMJXT
|