Baidu map cannot be loaded with vue+element modal box.

1. This is the tag code " < div id=" cellMap "> < / div >
2 for me to render Baidu map, and this is the code for me to click the button to display the modal box: `
handleCreate () {

.
             console.log(1232);
             this.centerDialogVisible = true;
             //console.log(document.getElementById("cellMap"));
             this.cellMap()
             //setInterval(this.cellInfMap(),2000);
         },`

3. This is how I render Baidu map: `
cellMap () {

             // API
            var map = new BMap.Map("cellMap");
            var point = new BMap.Point(116.404, 39.915);
            map.centerAndZoom(point, 15);
            var marker = new BMap.Marker(point);  // 
            map.addOverlay(marker);               // 
         },`

4, my problem now is to click the button twice to render Baidu map, declare the modal box when mounting, and there is no Baidu map in the method of calling Baidu map in mounted (). Which god can tell me how to solve it?

Mar.16,2021

Hello, I also encountered this problem. Have you solved


this.$nextTick(this.cellMap)

setTimeout(() => {
    _this.cellMap()()
}, 0);

Asynchronous can be added

Menu