treasure520 edited a comment on issue #1885: Uncaught TypeError: Cannot read 
property 'modLayer' of null
URL: 
https://github.com/apache/incubator-echarts/issues/1885#issuecomment-525752200
 
 
   我在把一個echarts圖形放進一個modal窗體時也遇到了同樣的錯誤。
   在載入頁面後的第一次顯示modal窗體時,echarts圖形可以正常顯示;
   但在關閉modal窗體後再次打開modal窗體時,圖形就不正常了,
   同樣報了Cannot read property 'modlayer' of null這個錯。
   後來我試著把echarts的初始化代碼放進modal窗體的'shown.bs.modal'事件裡,
   結果就可以正常運作了。
    
   $.ajax({  
     .....  
     .....  
     success: function(data) {  
       $('#modal').on('show.bs.modal', function() {  
         let myChart = echarts.init(document.getElementById('chart_idv');  
         let option = {  
           .....  
           .....  
         };  
         myChart.resize();  
         myChart.setOption(option);  
       });  
       $('#modal').modal();  
     },
   });
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to