fix: echart报错

This commit is contained in:
chenjianxing 2021-10-27 11:02:12 +08:00 committed by jianxing
parent 5f0d4a243f
commit e93b57e062
4 changed files with 24 additions and 4 deletions

View File

@ -1,8 +1,9 @@
<template>
<chart
:style="{'height': height + 'px'}"
class="ms-chart"
:init-options="defaultInitOptions"
:options="options"
:option="options"
:theme="theme"
:group="group"
@click="onClick"
@ -22,7 +23,13 @@ export default {
group: String,
autoresize: Boolean,
watchShallow: Boolean,
manualUpdate: Boolean
manualUpdate: Boolean,
height: {
type: Number,
default() {
return 400
}
}
},
data() {
return {

View File

@ -1,6 +1,6 @@
<template>
<div>
<ms-chart v-if="visible && data.length > 0" :options="options"/>
<ms-chart v-if="visible && data.length > 0" :options="options" :height="height"/>
<div v-if="visible && data.length <= 0" style="height: 300px">
</div>
@ -66,6 +66,12 @@ export default {
return []
}
},
height: {
type: Number,
default() {
return 400
}
}
},
watch: {
data() {

View File

@ -1,7 +1,7 @@
<template>
<div>
<ms-chart :options="options" @onClick="onClick">
<ms-chart :options="options" @onClick="onClick" :height="height">
</ms-chart>
</div>
@ -74,6 +74,12 @@ export default {
type: String,
default: ''
},
height: {
type: Number,
default() {
return 400
}
},
data: {
type: Array,
default() {

View File

@ -9,6 +9,7 @@ import 'echarts/lib/component/toolbox';
import 'echarts/lib/component/dataZoom';
import 'echarts/lib/component/legend';
import 'zrender/lib/svg/svg'
import 'echarts/lib/component/grid'
export default {
install(Vue) {