58 lines
1.1 KiB
Vue
58 lines
1.1 KiB
Vue
|
|
<!--
|
||
|
|
* @Author: yaolunmao
|
||
|
|
-->
|
||
|
|
<template>
|
||
|
|
<component :is="componentTag" :prop_data="component_prop"></component>
|
||
|
|
</template>
|
||
|
|
<script>
|
||
|
|
import { use } from "echarts/core";
|
||
|
|
import { SVGRenderer } from "echarts/renderers";
|
||
|
|
import { PieChart,BarChart } from "echarts/charts";
|
||
|
|
import {
|
||
|
|
TitleComponent,
|
||
|
|
TooltipComponent,
|
||
|
|
LegendComponent,
|
||
|
|
GridComponent
|
||
|
|
} from "echarts/components";
|
||
|
|
import { THEME_KEY } from "vue-echarts";
|
||
|
|
use([
|
||
|
|
SVGRenderer,
|
||
|
|
PieChart,
|
||
|
|
TitleComponent,
|
||
|
|
TooltipComponent,
|
||
|
|
LegendComponent,
|
||
|
|
GridComponent,
|
||
|
|
BarChart
|
||
|
|
]);
|
||
|
|
let importComponents = {};
|
||
|
|
export default {
|
||
|
|
props: ['svgInfoData', 'component_prop','component_type','component_template'],
|
||
|
|
data () {
|
||
|
|
return {
|
||
|
|
componentTag: '',
|
||
|
|
|
||
|
|
}
|
||
|
|
},
|
||
|
|
components: importComponents,
|
||
|
|
provide: {
|
||
|
|
// [THEME_KEY]: "dark"
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
|
||
|
|
},
|
||
|
|
created () {
|
||
|
|
|
||
|
|
this.svgInfoData.forEach(f => {
|
||
|
|
|
||
|
|
let componentInfo = {
|
||
|
|
template: f.template,
|
||
|
|
props: f.props
|
||
|
|
}
|
||
|
|
importComponents[f.type] = componentInfo;
|
||
|
|
})
|
||
|
|
this.componentTag = importComponents[this.component_type];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<style scoped>
|
||
|
|
</style>
|