提交
This commit is contained in:
58
src/components/SvgComponents.vue
Normal file
58
src/components/SvgComponents.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<!--
|
||||
* @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>
|
||||
Reference in New Issue
Block a user