<div v-if="grade<3" ref="gradeChart" style="height: 220px;width: 300px;margin:0 auto;">
mounted() {
this.$nextTick(() => {
setTimeout(()=>{
let map1=this.initEchartMap(this.gjfsx);
console.log(this.$refs.gradeChart,"ddkiiok")
},50)
})
解决方法将v-if改为v-show,控制台就没报错了
<div v-show="grade<3" ref="gradeChart" style="height: 220px;width: 300px;margin:0 auto;">