# 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: {
|
||||
sleep(time) {
|
||||
for (var temp = Date.now(); Date.now() - temp <= time;);
|
||||
},
|
||||
initMap() {
|
||||
this.map = new AMap.Map('map-container', {
|
||||
center: [114.143472, 22.284105],
|
||||
|
@ -171,6 +174,7 @@ export default {
|
|||
// cityd:'乌鲁木齐',
|
||||
// policy: AMap.DrivingPolicy.LEAST_TIME
|
||||
}
|
||||
this.sleep(500)
|
||||
const button = document.getElementById('bt')
|
||||
AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.Driving'], () => {
|
||||
map.addControl(new AMap.ToolBar())
|
||||
|
@ -203,6 +207,7 @@ export default {
|
|||
mounted() {
|
||||
if (this.mapClick) {
|
||||
const device_id = this.$store.getters.deviceID
|
||||
// this.sleep(2000)
|
||||
this.getDevicesInitMap({ device_id })
|
||||
} else {
|
||||
this.initMap()
|
||||
|
|
Loading…
Reference in New Issue