微信授权
-
须用户手动选择是否允许授权
wxml
<button wx:if="{{canIUse}}" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="bindGetUserInfo">授权登录</button> <view wx:else>请升级微信版本</view>
js
canIUse: wx.canIUse('button.open-type.getUserInfo') bindGetUserInfo: function (e){ console.log(e.detail.userInfo) }
授权成功获取code
wx.login({ success: function (res) { console.log(res); } })
-
可默认获取当前微信用户图像、昵称,无热更新
wxml
<open-data type="userAvatarUrl"></open-data> <open-data type="userNickName"></open-data>
调用系统电话
-
常用于信息页中联系方式调用
wxml
<button type="default" bindtap="Tel">拨打电话:13838059747</button>
js
Tel: function () { wx.makePhoneCall({ phoneNumber: '13838059747', //模拟测试 success: function () { console.log("拨打电话成功!") }, fail: function () { console.log("拨打电话失败!") } }) }
网友评论