因为每个图表都相同,想要用v-for循环echart图表循环的代码<el-col :span="6" v-for="(item,index) of items" :key="item.id">
<div class="body">
<div class="echart" :id="getID(index)"></div>
</div>
</el-col>动态的idgetID(index) { return "echart_" + index;
}echart绑定的idmounted() { this.$nextTick(function() { this.drawPie("chart");
});
},
drawPie(id) { this.charts = echarts.init(document.getElementById(id));
},怎么样将echart的id写成getID()方法中的ID
添加回答
举报
0/150
提交
取消