【uniapp开发小程序】点击获取手机号(使用@getphonenumber)
•
移动开发
一、实现效果

二、代码实现:
{{info.mobile}}
export default {
data() {
return {
info: {}, //个人信息
}
},
methods: {
// 获取手机号
getPhoneNumber(e) {
console.log(e)
var that = this;
if (e.detail.code) {
this.$api.appPlateForm('POST', this.$url.getPhoneNumber, {
code: e.detail.code,
}, function(res) {
if (res.code == '200') {
uni.setStorageSync('getPhone',res.data.phone)
console.log('打印获取的手机号',uni.getStorageSync('getPhone'))
that.info.mobile = res.data.phone
}
})
}else{
}
},
}
}
本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/ebabd50430.html
