# up map search

This commit is contained in:
xianfuxing 2018-08-29 00:07:55 +08:00
parent 46e801346b
commit 71db09ce38
1 changed files with 23 additions and 4 deletions

View File

@ -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
})
}