相信这个一个很实用的功能,相信大家都在网上购买过东西,而购买东西肯定需要收货地址,下面这个功能就能获取到微信上的收货地址
接下来我们就直接上代码
methods: {
wech() {
var that = this;
uni.chooseAddress({
success(res) {//当调取成功时返回的参数
console.log(res);
var obje = {//我这里直接把数据存在一个对象里
consignee: res.userName,
phone: res.telNumber,
location: res.provinceName + res.cityName + res.countyName,
detailed: res.detailInfo,
}
that.arrb.push(obje)//这里又把对象存进了数组方便输出
try {
uni.setStorageSync('token', that.arrb)
that.value = uni.getStorageSync("token");
} catch (e) {
//错误
}
}
})
},
}
有不对的地方欢迎大家指出错误