# bug fixed sleep until map initial then exec driving search
This commit is contained in:
parent
51e4259fd8
commit
cd67e8a495
|
@ -73,6 +73,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
sleep(time) {
|
||||||
|
for (var temp = Date.now(); Date.now() - temp <= time;);
|
||||||
|
},
|
||||||
initMap() {
|
initMap() {
|
||||||
this.map = new AMap.Map('map-container', {
|
this.map = new AMap.Map('map-container', {
|
||||||
center: [114.143472, 22.284105],
|
center: [114.143472, 22.284105],
|
||||||
|
@ -171,6 +174,7 @@ export default {
|
||||||
// cityd:'乌鲁木齐',
|
// cityd:'乌鲁木齐',
|
||||||
// policy: AMap.DrivingPolicy.LEAST_TIME
|
// policy: AMap.DrivingPolicy.LEAST_TIME
|
||||||
}
|
}
|
||||||
|
this.sleep(500)
|
||||||
const button = document.getElementById('bt')
|
const button = document.getElementById('bt')
|
||||||
AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.Driving'], () => {
|
AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.Driving'], () => {
|
||||||
map.addControl(new AMap.ToolBar())
|
map.addControl(new AMap.ToolBar())
|
||||||
|
@ -203,6 +207,7 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.mapClick) {
|
if (this.mapClick) {
|
||||||
const device_id = this.$store.getters.deviceID
|
const device_id = this.$store.getters.deviceID
|
||||||
|
// this.sleep(2000)
|
||||||
this.getDevicesInitMap({ device_id })
|
this.getDevicesInitMap({ device_id })
|
||||||
} else {
|
} else {
|
||||||
this.initMap()
|
this.initMap()
|
||||||
|
|
Loading…
Reference in New Issue