前言
最近開發(fā)公司手機(jī)快捷登錄的功能,花費(fèi)了不少時(shí)間,這里附上詳細(xì)教程。
這里以海底撈小程序的圖片為例,如有侵權(quán)請聯(lián)系小編刪除。文章來源:http://www.zghlxwxcb.cn/news/detail-702086.html
代碼如下
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">手機(jī)號(hào)快捷登錄</button>
getPhoneNumber(e) {
if (e.detail.errMsg == "getPhoneNumber:ok") {
this.encryptedData = e.detail.encryptedData;
this.iv = e.detail.iv;
this.code = e.detail.code;
this.Login(); // 這里調(diào)用登錄/注冊的接口
} else {
// 點(diǎn)擊"不允許"
uni.showModal({
title: '提示',
content: '需要通過授權(quán)才能繼續(xù),請重新點(diǎn)擊并授權(quán)!',
showCancel: false,
success: function(res) {
if (res.confirm) {
console.log('');
}
}
});
}
}
開發(fā)中遇到的問題
1、如果在微信開發(fā)者工具彈出下邊的提示,不要慌張,用真機(jī)預(yù)覽,其實(shí)是生效的。文章來源地址http://www.zghlxwxcb.cn/news/detail-702086.html
到了這里,關(guān)于微信小程序 - 2023年最新版手機(jī)號(hào)快捷登錄詳細(xì)教程的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!