欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 维修 > vue2+echarts:echarts在dialog弹框中不显示的解决方案

vue2+echarts:echarts在dialog弹框中不显示的解决方案

2025/10/12 3:07:19 来源:https://blog.csdn.net/weixin_43928112/article/details/139662962  浏览:    关键词:vue2+echarts:echarts在dialog弹框中不显示的解决方案

重点是@open方法里使用$nextTick拿到最新的dom,在里面加载echarts 

//html
<el-button @click.stop="getIfStorage"></el-button><el-dialog title="图表数据" :visible.sync="ifStorageShowOpen" @open="open()" width="1400px" append-to-body><div id="chart" style="height: 600px" ref="chart"></div>
</el-dialog>//dataifStorageShowOpen: false,chart: null,// echarts图表实例//jsgetIfStorage () {this.ifStorageShowOpen = true},open () {this.$nextTick(() => {this.initChart();})},// 初始化echartsinitChart () {this.chart = this.$echarts.init(this.$refs.chart)// 设置图表option(配置项)绘制图表// 绘制图表this.chart.setOption({title: {text: '商品销售数据'},tooltip: {},xAxis: {data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']},yAxis: {type: 'value'},backgroundColor: '#dddddd',color: ['#72ccff', '#d4a4eb'],series: [{name: '销量',type: 'bar', // 柱状图data: [5, 20, 36, 10, 10, 20]},{name: '利润',smooth: true,type: 'line', // 折线图data: [2, 23, 5, 54, 9, 33]}]})},

 


 上一篇文章,

uniapp踩坑之项目:uni-app实现下拉框多选_uniapp 多选-CSDN博客文章浏览阅读881次,点赞5次,收藏5次。uniapp踩坑之项目:uni-app实现下拉框多选。一、首先创建组件,二、将组件引入单页面使用_uniapp 多选https://blog.csdn.net/weixin_43928112/article/details/138559471?spm=1001.2014.3001.5501

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词