//获取地址
selectLocation() {
uni.getSetting({
success:(res)=> {
uni.chooseLocation({
success: (res) => {
console.log('地址信息:'+JSON.stringify(res));
this.inputData.AreaCode = res.name
this.inputData.CurrentPosition = res.address
this.inputData.PositionX = res.latitude
this.inputData.PositionY = res.longitude
},
})
},
})
},
data:function(){
return {
inputData:{
AreaCode:'', //地区码
CurrentPosition:'' ,//地区名称
PositionX:'', //纬度
PositionY:'', //经度
},
<view class="item">
<view class="title">所在地</view>
<view class="input extend"><input type="text" placeholder="点击选择所在地" :disabled="true" v-model="inputData.CurrentPosition" @click="selectLocation"/></view>
</view>