找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 小程序开发 查看内容

微信小程序例子——添加手机联系人、调节手机屏幕亮度

作者:模板之家 2018-4-20 10:53 1794人关注

微信小程序例子添加手机联系人、调节手机屏幕亮度 1、界面展示【使用滑动选择器控制手机屏幕亮度】 2、关键代码 1)、WXML代码 1 来自CODE的代码片 snippet_file_0.txt 2)、JS代码 1 2 3 4

微信小程序例子——添加手机联系人、调节手机屏幕亮度

 
 
 

1、界面展示【使用滑动选择器控制手机屏幕亮度】

 

2、关键代码

1)、WXML代码

 


 1

 来自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、调节手机屏幕亮度效果展示:

      

2、关键代码

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'//测试用的号码,并非真实号码
},
// 长按号码响应函数
phoneNumTap:function(){
var that=this;
// 提示呼叫号码还是将号码添加到手机通讯录
wx.showActionSheet({
itemList: ['呼叫','添加联系人'],
success:function(res){
if(res.tapIndex===0){
// 呼叫号码
wx.makePhoneCall({
phoneNumber: that.data.phoneNum,
})
}else if(res.tapIndex==1){
// 添加到手机通讯录
wx.addPhoneContact({
firstName: 'test',//联系人姓名
mobilePhoneNumber: that.data.phoneNum,//联系人手机号
})
}
}
})
}
})
 来自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



路过

雷人

握手

鲜花

鸡蛋
原作者: 模板之家 来自: 网络收集

全部回复(0)