本文实例为大家分享了微信小程序获取用户信息及手机号的具体代码,供大家参考,具体内容如下

wxml页面
<view wx:if="{{config.tipsshow1}}" class='dialog-container'>
<view class='dialog-mask'></view>
<view class='dialog-info'>
<view class='dialog-title'>login prompt</view>
<view class='dialog-content'>To provide better service, click "allow" in the prompt box later!</view>
<view class='dialog-footer'>
<button class='dialog-btn' open-type="getUserInfo" bindgetuserinfo="getUserInfo">I see.</button>
</view>
</view>
</view>
<view wx:if="{{config.tipsshow2}}" class='dialog-container'>
<view class='dialog-mask'></view>
<view class='dialog-info'>
<view class='dialog-title'>login prompt</view>
<view class='dialog-content'>To provide better service, click "allow" in the prompt box later!</view>
<view class='dialog-footer'>
<button class='dialog-btn' open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">To authorize.</button>
</view>
</view>
</view>