關於使用layer彈出框展現echarts不顯示的問題

html頁面是這樣的

<div id="showScoreDetail" style="display: none;">
    <div class="layuiWindownContent">
        <form class="layui-form" id="scoreFrom">
        	<div id="chart-score" style="width:850px; height: 360px"></div>
        </form>
    </div>
</div>

彈出框代碼是這樣的

var showContent = $('#showScoreDetail').html();
layer.open({
    type: 1,
    id: 'showLayui',
    shade: false,
    title: season + "季度明細",
    content: showContent,
    area: ['900px', '500px'],
    btn: ['關閉'],
    btnAlign: 'c',
    success: function (layero, index) {
        
    }, end: function () {
        // $('#showScoreDetail').html(showContent);
    }
});

調試看到彈框是出現了,canvas也有,就是不顯示,網上說是div有_echarts_instance屬性,需要重繪

添加如下代碼

document.getElementById('chart-score').removeAttribute('_echarts_instance_');
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章