Merge pull request '邓洁:首页定位' (#31) from dengjie into master

Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/31
This commit is contained in:
odjbin
2023-11-08 06:19:43 +00:00

View File

@@ -35,8 +35,7 @@
}, },
data() { data() {
return { return {
position: '定位12', position: ''
location: ''
}; };
}, },
options: { options: {
@@ -45,21 +44,10 @@
created() { created() {
console.log('createsd'); console.log('createsd');
this.open() this.open()
console.log('location', this.location);
},
watch: {
location(val) {
console.log('foo变化了变化后的值是', val)
// 具体操作=>doSomething
}
},
onShow() {
console.log('onshow');
// const location = this.open()
// console.log('location', this.location);
}, },
methods: { methods: {
getLocation1() { getLocation1() {
var that = this
let qqmapsdk = new QQMapWX({ let qqmapsdk = new QQMapWX({
key: 'ZRKBZ-Q7FWL-GVZPK-MCRBU-4XFB5-ATBDB' key: 'ZRKBZ-Q7FWL-GVZPK-MCRBU-4XFB5-ATBDB'
}); });
@@ -74,11 +62,12 @@
longitude: res.longitude longitude: res.longitude
}, },
success: (re) => { success: (re) => {
console.log("解析地址成功", res); console.log("解析地址成功", re);
console.log(re.result.ad_info.city, '成都市=='); console.log(re.result.ad_info.city,);
console.log(re.result.ad_info.district, '武侯区=='); console.log(re.result.ad_info.district, );
this.location = re.result.ad_info let city=re.result.ad_info.city
console.log('success', this.location); let district=re.result.ad_info.district
that.position = city.slice(0,2) + district.slice(0,2)
}, },
fail: (re) => { fail: (re) => {
console.log(re, '失败信息'); console.log(re, '失败信息');