65 lines
1.7 KiB
Vue
65 lines
1.7 KiB
Vue
<template>
|
|
<view>
|
|
<input type="text" v-model="keywords"/>
|
|
<view @click="inpuCity">搜索</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default{
|
|
data(){
|
|
return{
|
|
keywords:''
|
|
}
|
|
},
|
|
onLoad() {
|
|
var that=this;
|
|
|
|
},
|
|
methods:{
|
|
inpuCity(){
|
|
var that=this;
|
|
that.$nextTick(() =>{
|
|
that.getCity()
|
|
},100)
|
|
},
|
|
getCity(e){
|
|
// this.keywords=e.detail.value;
|
|
var that=this;
|
|
const value = uni.getStorageSync('citySou');
|
|
var dizhi={
|
|
// a90dccd8b55793bb939c38c7a4be3e15
|
|
key:'4f23770b6e53b96e7d0661a7ccfb9c21',
|
|
keywords:that.keywords,
|
|
city:'城市中文'+'|'+'citycode'+'|'+'中文全拼'+'|'+'adcode',
|
|
citylimit:true,
|
|
datatype:'all',
|
|
location:'125.424295,43.878294',
|
|
output:'JSON',
|
|
// type:'010000'+'|'+'020000'+'|'+'030000'+'|'+'040000'+'|'+'050000'+'|'+'060000'
|
|
// +'|'+'070000'+'|'+'080000'+'|'+'090000'+'|'+'100000'+'|'+'110000'+'|'+'120000'
|
|
// +'|'+'130000'+'|'+'140000'+'|'+'150000'+'|'+'160000'+'|'+'170000'+'|'+'180000'
|
|
// +'|'+'190000'+'|'+'200000'+'|'+'220000'+'|'+'970000'+'|'+'990000'+'|'+'991000'+'|'+'991001'
|
|
// +'|'+'991400'+'|'+'991401'+'|'+'991500'+'|'+'991600'+'|'+'991601'
|
|
// ,
|
|
// type:'010000|020000|030000|040000|050000|060000|080000|090000|100000|110000|120000|130000|140000|150000|160000|170000|180000|190000|200000',
|
|
}
|
|
uni.request({
|
|
url: 'https://restapi.amap.com/v3/assistant/inputtips',
|
|
data:dizhi,
|
|
method:'GET',
|
|
success(res) {
|
|
if (res.statusCode ==200) {
|
|
// that.city = res.data.regeocode.formatted_address
|
|
} else {
|
|
console.log("获取信息失败,请重试!")
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style> |