Vue+G2:Please specify the container for the chart! + Cannot read property ‘appendChild‘ of null
研究了一下午,终于搞懂了是为啥。
先看一下代码,两个tab标签页,其中一个放chart的挂在节点,但是初始化的时候一直报两个错。
<a-tabs default-active-key="1" @change="callback"><a-tab-pane key="1" tab="预览"><a-tablesize="small":pagination="false":scroll="{x: 10000, y: 500}":columns="columns":data-source="data"></a-table></a-tab-pane><a-tab-pane key="3" tab="可视化"><div id="chartMountNode"></div></a-tab-pane></a-tabs>
const graphMountNode = document.getElementById("chartMountNode")this.chart = new G2.Chart({container: graphMountNode,width: 600,height: 300});
Please specify the container for the chart!
这个是因为chartMountNode
的div不存在导致的,在G2画图之前div还没有渲染。
但问题是,default-active-key
指定的是1,所以3标签页里挂载节点的div还没有渲染,所以,不能放在这里。
TypeError: Cannot read property 'appendChild' of null
this.chart = new G2.Chart({container: "chartMountNode",width: 600,height: 300});
这个不知道是为啥,直接从文档里复制过来的代码结果不能运行,只能用document.getElementById
先获取元素。
Vue+G2:Please specify the container for the chart! + Cannot read property ‘appendChild‘ of null相关推荐
- 报错,atmSecondMenu.vue?bcc9:231 Uncaught (in promise) TypeError: Cannot read property ‘length‘ of null
问题: atmSecondMenu.vue?bcc9:231 Uncaught (in promise) TypeError: Cannot read property 'length' of nul ...
- vue报错问题记录1-Cannot read property '0' of null
1.场景描述 项目采用element ui组件库,出现这个问题是在表格中套用标签. <template>.....<el-table-columnprop="blogTag ...
- Vue报错:Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object 的解决方法
Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法 参考文章: (1)Vue ...
- [Vue warn]: Error in callback for watcher “lists“: “TypeError: Cannot read property ‘length‘ of unde
[Vue warn]: Error in callback for watcher "lists": "TypeError: Cannot read property ' ...
- vue.js:597 [Vue warn]: Error in callback for watcher dat: TypeError: Cannot read property 'call'
vue.js:597 [Vue warn]: Error in callback for watcher "dat": "TypeError: Cannot read p ...
- [Vue warn]: Error in v-on handler (Promise/async): “TypeError: Cannot read property ‘status‘ of 问题详解
错误样式: [Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read property 'stat ...
- Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#Object‘的解决方法...
发现问题 运行一下以前的一个Vue+webpack的 vue仿新闻网站 小项目,报错 由于自己vue学习不深入,老是这个报错,找了好久(确切的说是整整一下午^...^)才找到原因 -v- Uncau ...
- vue引入three.js3维地图_vue-chartjs使用 Chart.js 和 Vue.js 搭建简单和漂亮的图表
简介 vue-chartjs 让你在 Vue 中能更好的使用 Chart.js . 非常适合想要尽快启动和运行简单图表的人.它抽象了一些简单的逻辑, 但是也暴露了 Chart.js 对象, 提供了极大 ...
- Please specify the container for the chart!
翻译为:请指定图表的容器! 我这边是使用antV来可视化,和echarts差不多 首先会有一个div来承载展示内容 下面当然会有js来渲染展示 我这边的主要内容就是js在渲染展示内容的时候,指定的di ...
最新文章
- “老赖”罗永浩:就算“卖艺”也会还债!孙宇晨:我买!
- sota如何创建作业及配置作业文件详解(章节5)
- 并发-9-Callable和Future
- 查看LoadRunner脚本请求日志和服务器返回值方法
- 【转载】SOA面向服务架构简述
- 报任安书文言现象_干货丨文言文句式详解,快点收藏!
- Sql Server 中存储过程的output return的区别
- [vue] SSR解决了什么问题?有做过SSR吗?你是怎么做的?
- SQL Server-数据类型(七)
- 2021 年前端趋势预测
- 网站访客系统php,PHP实现网站访客来访显示访客IP浏览器操作系统
- 英语(10)---脱口而出的英语
- html盒子阴影效果,CSS3给div或者文字添加阴影(盒子阴影、文本阴影的使用)
- 11.24 《阿猫阿狗2》精美包装艳丽登场
- linux重启openfire服务,Centos下Openfire详细安装过程
- 【软件项目管理】期末复习
- 日照科技中等专业学校 远程预付费系统的设计与应用
- vbox虚拟机和vm虚拟机 虚拟机网络不通的解决方法
- C/C++编程:trivial和non-trivial
- java日期计算天数_用Java计算两个日期之间的天数
热门文章
- 默认轮播,鼠标移入停止,移出继续
- linux 设置中文版man手册
- 移动互联网与传统互联网体验上的区别及功能测试要点(总结自《大话移动APP测试》)...
- 2016 CCPC 杭州站 小结
- 2015 UESTC Training for Search Algorithm String - M - Palindromic String【Manacher回文串】
- Windows 下目录及文件向Linux同步
- 在路上(on the road)
- 聚类结果不好怎么办_使用bert-serving生成词向量并聚类可视化
- linux除了cat读取文件内容,linux cut命令和cat命令以及查看文件内容命令总结
- java追加一个sheet_(二)POI-创建一个sheet页,并添加行列数据