关于使用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_');
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章