Zhuyi731 / echarts-for-wx-uniapp

uni-app echarts vue2小程序专用
332 stars 37 forks source link

无法描述之错误 #17

Closed WangXinYu-China closed 4 years ago

WangXinYu-China commented 4 years ago

VM9227:1 TypeError: Converting circular structure to JSON --> starting at object with constructor 'Wl' | property '_dom' -> object with constructor 'WxCanvas' --- property 'chart' closes the circle

表现描述: 进到页面开始报错,之后所有共21个页面所有的前端交互全部崩盘。

求助,可有大神解答

Zhuyi731 commented 4 years ago

VM9227:1 TypeError: Converting circular structure to JSON --> starting at object with constructor 'Wl' | property '_dom' -> object with constructor 'WxCanvas' --- property 'chart' closes the circle

表现描述: 进到页面开始报错,之后所有共21个页面所有的前端交互全部崩盘。

求助,可有大神解答

这个是因为data里有一个循环引用的对象,你可以将这个对象名称设置为$开头的就解决了

WangXinYu-China commented 4 years ago

VM9227:1 TypeError: Converting circular structure to JSON --> starting at object with constructor 'Wl' | property '_dom' -> object with constructor 'WxCanvas' --- property 'chart' closes the circle 表现描述: 进到页面开始报错,之后所有共21个页面所有的前端交互全部崩盘。 求助,可有大神解答

这个是因为data里有一个循环引用的对象,你可以将这个对象名称设置为$开头的就解决了

好的,谢谢您,我尝试改下

Zhuyi731 commented 4 years ago

VM9227:1 TypeError: Converting circular structure to JSON --> starting at object with constructor 'Wl' | property '_dom' -> object with constructor 'WxCanvas' --- property 'chart' closes the circle 表现描述: 进到页面开始报错,之后所有共21个页面所有的前端交互全部崩盘。 求助,可有大神解答

这个是因为data里有一个循环引用的对象,你可以将这个对象名称设置为$开头的就解决了

在的,清楚是什么原因导致的么

uni-app在转编译时会对data对象做JSON.stringify。 如果data有循环引用就会导致栈溢出。而以$开头的对象不会被处理,这也是为什么这里面实例获取要以$curChart来获取的原因

WangXinYu-China commented 4 years ago

data() { return { active: 0, todyStudyTime: null, weekStudyTime: null, accuracy: null, practicedNum: 0, show: false, columns: [], graspedKnowledge: 0, allKnowledge: 0, nowKnowledge: '', ec: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } }, eca: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } } } }

我所有的 data数据都在这里了,您有时间的时候方便看下么 没找到症结所在

data() { return { active: 0, todyStudyTime: null, weekStudyTime: null, accuracy: null, practicedNum: 0, show: false, columns: [], graspedKnowledge: 0, allKnowledge: 0, nowKnowledge: '', ec: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } }, eca: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } } } } 我所有的 data数据都在这里了,您有时间的时候方便看下么 没找到症结所在

我等会看下,找到问题了回复你。 看起来是组件内部的chart循环了

页面需要两个chart,我先放两个在这里,改了下id、ref、canvas-id,就先扔那了。将其中一个注释掉,依然存在上述问题。

Zhuyi731 commented 4 years ago

data() { return { active: 0, todyStudyTime: null, weekStudyTime: null, accuracy: null, practicedNum: 0, show: false, columns: [], graspedKnowledge: 0, allKnowledge: 0, nowKnowledge: '', ec: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } }, eca: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } } } }

我所有的 data数据都在这里了,您有时间的时候方便看下么 没找到症结所在

我等会看下,找到问题了回复你。 看起来是组件内部的chart循环了

WangXinYu-China commented 4 years ago

data() { return { active: 0, todyStudyTime: null, weekStudyTime: null, accuracy: null, practicedNum: 0, show: false, columns: [], graspedKnowledge: 0, allKnowledge: 0, nowKnowledge: '', ec: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } }, eca: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } } } } 我所有的 data数据都在这里了,您有时间的时候方便看下么 没找到症结所在

我等会看下,找到问题了回复你。 看起来是组件内部的chart循环了

页面需要两个chart,我先放两个在这里,改了下id、ref、canvas-id,就先扔那了。将其中一个注释掉,依然存在上述问题。

Zhuyi731 commented 4 years ago

data() { return { active: 0, todyStudyTime: null, weekStudyTime: null, accuracy: null, practicedNum: 0, show: false, columns: [], graspedKnowledge: 0, allKnowledge: 0, nowKnowledge: '', ec: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } }, eca: { lazyLoad:true, option: { color: ['#3398DB'], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], axisTick: { alignWithLabel: true } } ], yAxis: [ { type: 'value' } ], series: [ { name: '直接访问', type: 'bar', barWidth: '60%', data: [10, 52, 200, 334, 390, 330, 220] } ] } } } } 我所有的 data数据都在这里了,您有时间的时候方便看下么 没找到症结所在

我等会看下,找到问题了回复你。 看起来是组件内部的chart循环了

页面需要两个chart,我先放两个在这里,改了下id、ref、canvas-id,就先扔那了。将其中一个注释掉,依然存在上述问题。

image 能把你完整代码贴一下吗 我这里似乎没出现这个问题

WangXinYu-China commented 4 years ago

`

`

嗯 界面 可以出来 我这也是两个echarts都出来了 全部的

WangXinYu-China commented 4 years ago

效果图.png

Zhuyi731 commented 4 years ago

我试了各种姿势,在我这里没法复现,你可能需要进入错误里面看一下是哪个对象循环了。 还有
import * as echarts from '../../uni-ec-canvas/echarts'
这段是不需要的

WangXinYu-China commented 4 years ago

好的 谢谢了

WangXinYu-China commented 4 years ago

兄弟 我发现我这里是页面离开的时候 报的这个错误 这就很难受