首页 VueJS Vue中实现Echarts

Vue中实现Echarts

作者:胡同里的砖头 围观群众:272 更新于:2021-11-11

前端放入div如下
<div id="container" :style="{ height: height, width: width }" />


async Bind() {
await Get_Pou_ByHour(this.listQuery.intime,"count").then(res=>{
let chartdom = document.getElementById('container');
this.echarts_img(res.cols,res.data).then(option=>{
var myChart = echarts.init(chartdom);
if (option && typeof option === 'object') {
myChart.setOption(option);
}
})
});

},
echarts_img(cols,data){
//放option变量外面的charts图代码即可
var option = {
//放option里面的charts图代码即可
};

return Promise.resolve(option);
}

  • 本文标题: Vue中实现Echarts
  • 文章分类:【VueJS】
  • 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.
留言评论
站点声明:
1、本站【胡同里的砖头】个人博客,借鉴网上一些博客模板,取其各优点模块自行拼装开发,本博客开发纯属个人爱好。
2、所有笔记提供给广大用户交流使用,可转载,可复制,纯个人开发所遇问题锦集记录使用
Copyright © huzlblog.com All Rights Reserved. 备案号:苏ICP备2021056683号-8