WX:如下
<button type=“primary” open-type=“getphonenumber” bindgetphonenumber=“getPhoneNumber” style="{{denglu.by5}}">使用微信快速登录</button>
JS如下:
getPhoneNumber:function(e){
console.log(e)
}
为什么没反应
这里路径
<view style="{{}}">
<image style="{{beijing}}" src="src"></image>
</view>
<view style="{{denglu.by}}">
<block wx:if="{{qiehuan1==1}}">
<view style="{{denglu.by1}}">手机号</view>
<button type="primary" bindtap="dengluss" style="{{denglu.by2}}">登录</button>
<input maxlength='11' type="number" value="{{shuru[0]}}" bindinput="shurus" style="{{denglu.by4}}" />
<view data-aaaa='0' bindtap="shoujideng" style="{{denglu.by6}};top:150rpx">微信快速登录</view>
</block>
<block wx:else>
<button type="primary" open-type="getphonenumber" bindgetphonenumber="getPhoneNumber" style="{{denglu.by5}}">使用微信快速登录</button>
<view data-aaaa='1' bindtap="shoujideng" style="{{denglu.by6}}">输入手机号登录</view>
<image style="{{denglu.by14}}" src="../../images/weixing.png"></image>
</block>
<button bindtap="fanhui" style="{{denglu.by7}}">稍后登录并返回</button>
<text style="{{denglu.by12}}">登录即表示已阅读并同意</text>
<text bindtap='' style="{{denglu.by13}}" >《用户使用条款》</text>
</view>
<block wx:if="{{qiehuan==1}}">
<view style="{{denglu.by8}}">
<view style="{{denglu.by9}}">验证码</view>
<input focus="{{jiaodianhuoqu[0]}}" style="{{denglu.by10}}"maxlength="1"type="number" />
<input focus="{{jiaodianhuoqu[1]}}" style="{{denglu.by10}};left:130rpx"maxlength="1"type="number" />
<input focus="{{jiaodianhuoqu[2]}}" style="{{denglu.by10}};left:220rpx"maxlength="1"type="number" />
<input focus="{{jiaodianhuoqu[3]}}" style="{{denglu.by10}};left:310rpx"maxlength="1"type="number" />
<button style="{{denglu.by11}}" bindtap="yanzhengqueding" >确定</button>
</view>
</block>
这是我整页的代码
JS如下:
getPhoneNumber:function(e){
console.log(e)
var errMsg = e.detail.errMsg
var encryptedData = e.detail.encryptedData
var iv = e.detail.iv
var key = appInstance.hhkey
console.log(e)
wx.request({
url: 'XXXXXXXXXXXXXXXXXXXXXXXXXXX‘,’
data: {
key: key, iv: iv, encryptedData: encryptedData
},
success: function (res) {
}})
},