# up async plugin

This commit is contained in:
xianfuxing 2018-09-03 20:08:42 +08:00
parent b21d0af572
commit dd4da1e6f4
1 changed files with 13 additions and 14 deletions

View File

@ -169,12 +169,6 @@ export default {
resizeEnable: true,
zoom: 13
})
// new AMap.Marker({
// position: this.coordinate,
// zIndex: 10,
// title: this.deviceList[0].title,
// map: map
// })
const drivingOptions = {
map: map,
// city: '',
@ -182,16 +176,21 @@ export default {
// cityd:'',
// policy: AMap.DrivingPolicy.LEAST_TIME
}
const driving = new AMap.Driving(drivingOptions)
const button = document.getElementById('bt')
driving.search(new AMap.LngLat(113.344095, 22.673091), new AMap.LngLat(113.203460828994, 22.64902452257), (status, result) => {
button.onclick = () => {
driving.searchOnAMAP({
origin: result.origin,
destination: result.destination
})
}
AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.Driving'], () => {
map.addControl(new AMap.ToolBar())
map.addControl(new AMap.Scale())
const driving = new AMap.Driving(drivingOptions)
driving.search(new AMap.LngLat(113.344095, 22.673091), new AMap.LngLat(113.203460828994, 22.64902452257), (status, result) => {
button.onclick = () => {
driving.searchOnAMAP({
origin: result.origin,
destination: result.destination
})
}
})
})
// const driving = new AMap.Driving(drivingOptions)
this.flag = true
// if (AMap.UA.mobile) {
// document.getElementById('panel').style.display = 'none'