混合uniapp 根据手机定位ip地址
·
获取定位ip地址
get_dw() {
let _this = this;
uni.request({
url: 'http://api.map.baidu.com/location/ip?ak=gdtN2tdbKu9hV7WWP1YScawlwoi2TjVo&coor=bd09ll',
data: {
},
header: {
},
success: (res) => {
let city = res.data.content.address_detail.city;
_this.city = city || '获取中...';
_this.$store.commit('City', _this.city);
},
fail() {
_this.city = '全国';
_this.$store.commit('City', _this.city);
}
});
}
更多推荐
所有评论(0)