Loading…

Get your mobile number with one click

Table of contents on this page
# Select capabilities ![](https://dcdn.it120.cc/yuque/0/2022/png/572726/1657114831185-97f20ffc-8830-4dce-ae3b-d411a8d566f3.png) After this capability is added, it must be applied through the subsequent user information before it can be used. # Mini program code [https://opendocs.alipay.com/mini/api/getphonenumber](https://opendocs.alipay.com/mini/api/getphonenumber) ```javascript ``` open-type and scope are indispensable```javascript async getPhoneNumberAlipay() { console.log(1111); my.getPhoneNumber({ success: (res) => { this._getPhoneNumberAlipay(res.response) }, fail: (res) => { console.log(res); console.log('getPhoneNumber_fail'); }, }) }, async _getPhoneNumberAlipay(encryptedData) { console.log(2222); const res = await this.$wxapi.aliappBindMobile({ token: this.token, encryptedData: encryptedData }) if (res.code == 0) { wx.showToast({ title: 'Binding successful', icon: 'success', duration: 2000 }) this.$u.vuex('mobile', res.data) } else { wx.showModal({ title: 'Tips', content: res.msg, showCancel: false }) } }, onAuthError() { console.log(33333); console.log('onAuthErroronAuthErroronAuthErroronAuthErroronAuthError'); }, ```