Today, use ecarts + Vue as the icon and prompt Vue. Runtime. ESM. JS?2b0e: 619 [Vue warn]: error in mounted hook: "typeerror: cannot read property 'getattribute' of undefined"
‘
I found some friends on the Internet and said, “yes, what should be loaded into the mounted this. $nexttick
“, but it’s not. I wrote the value of refs wrong
Now let’s start looking for mistakes
html
<template>
<div class="echart-box" style="width: 280px;
height:220px" ref="line_only_dom"></div>
</template>
js
mounted() {
this.drawLine();
},
methods: {
drawLine() {
let self = this;
let line_dom = this.$refs.line_dom;
this.mychart = this.$echarts.init(line_dom);
}
}
Solution:
let line_dom = this.$refs.line_dom;
change to let line_only_dom = this.$refs.line_only_dom;
, this error will be solved
Similar Posts:
- How to Solve Vue Import Chinese Map & Echarts Import China Error
- [Solved] echart Error: Can’t get dom width or height
- [Solved] Error: `resize` should not be called during main process.
- [Solved] Vue Import echarts error: Error in mounted hook: “TypeError: Cannot read property ‘init’ of undefined”
- UICollectionView must be initialized with a non-nil layout parameter [Solved]
- Ffmpeg scaling — the solution of “width / height not divisible by 2”
- [Solved] Vue Import echarts Error: export ‘default‘ (imported as ‘echarts‘) was not found in ‘echarts‘
- Document.body.clientheight cannot get the browser page height correctly
- [Solved] Java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
- A problem with 0 document. Documentelement. Clientwidth