# up map search
This commit is contained in:
parent
46e801346b
commit
71db09ce38
|
@ -29,6 +29,7 @@ const defaultEvents = {
|
|||
export default {
|
||||
name: 'amap',
|
||||
data() {
|
||||
const self = this
|
||||
return {
|
||||
flag: false,
|
||||
defaultPositions: [
|
||||
|
@ -65,11 +66,29 @@ export default {
|
|||
center: [],
|
||||
markers: [],
|
||||
plugin: ['ToolBar', {
|
||||
pName: 'MapType',
|
||||
defaultType: 0,
|
||||
pName: 'Geolocation',
|
||||
events: {
|
||||
init(o) {
|
||||
console.log(o)
|
||||
// o 是高德地图定位插件实例
|
||||
o.getCurrentPosition((status, result) => {
|
||||
if (result && result.position) {
|
||||
const lng = result.position.lng
|
||||
const lat = result.position.lat
|
||||
self.center = [lng, lat]
|
||||
// self.loaded = true
|
||||
self.$nextTick()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
pName: 'Driving',
|
||||
events: {
|
||||
init(o) {
|
||||
o.search(self.center, [113.276316, 23.112071], (status, result) => {
|
||||
console.log(status, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
@ -97,7 +116,7 @@ export default {
|
|||
marker.dragend = false
|
||||
marker.events = defaultEvents
|
||||
this.markers.push(marker)
|
||||
this.center = this.coordinate
|
||||
// this.center = this.coordinate
|
||||
this.flag = true
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue