Error: Initialize failed: invalid dom加载出现的问题

354 阅读1分钟
  • 1.错误信息如图

image.png

  • 2.解决方法
// 方法1
function initEcharts () {
	// 新建一个promise对象
	let newPromise = new Promise((resolve) => {
		resolve()
	})
	//然后异步执行echarts的初始化函数
	newPromise.then(() => {
		//	此dom为echarts图标展示dom
		echarts.init(DOm)
	})
}

// 方法2
//这里不要用created(用mounted),created这时候还只是创建了实例,但模板还没挂载完成
mounted() {
   this.initData()
}

// 方法3
//用this.$nextTick(()=>{}) (这个回调函数会在数据挂载更新完之后执行,所以可行
this.$nextTick(() => {
        charts = this.$echarts.init(this.$refs.echart)
        charts.clear()
        charts.resize()
        charts.setOption(option)
        this.loading = false
 })

人生总是充满遗憾:Life is filled with regrets.

Life is filled with regrets. Ask anyone around you what their regrets are and they usually have no difficulty coming up with many items on their “regret list.” And for some reason our twenties are ripe for a field of regrets.

努力到无能为力,拼搏到感动自己

I regret not travelling more, and so does nearly everyone that I have asked. Before kids, and mortgages and marriages, when our commitments and expenses were lower, the opportunities for travel were much greater, but for some reason many of us thought we’d always have time for travel later.

我后悔没有到更多的地方去旅行,而且几乎我问过的每个人都会这样说。在有孩子之前、在抵押贷款和结婚之前,在我们需要承担的责任和花销较少时,正是旅游的大好机,但是由于种种原因,我们总觉得我们以后会有更多的时间去旅行。
We dreamed of visiting the pyramids of Egypt, surfing off the Hawaiian coast, dining at a Parisian café, drinking espresso in Rome, trekking through the rainforest, and so much more. Sadly, many of us never made these journeys and the opportunity passed us by.
我们梦想过去埃及看金字塔,在夏威夷海边冲浪,在巴黎的咖啡馆共进晚餐,在罗马品尝香浓的咖啡,徒步穿越热带雨林等等诸如此类的计划。可悲的是,大部分人都没有付诸行动,只是看着机会白白溜走。