|
@@ -5,6 +5,7 @@ import Markdown from '/@/components/markdown/Markdown.vue'
|
|
|
import type { ComponentLibraryItem, Content } from './types'
|
|
|
import { MarkdownPlugin } from '/@/components/markdown/type/markdown'
|
|
|
import EChartsPlugin from '/@/components/markdown/plugins/echarts'
|
|
|
+import VueCharts from '/@/components/markdown/plugins/impl/VueCharts.vue'
|
|
|
|
|
|
const plugin: Array<MarkdownPlugin<any>> = [EChartsPlugin()]
|
|
|
|
|
@@ -25,7 +26,8 @@ const handleDragStart = (event: DragEvent, component: any) => {
|
|
|
|
|
|
event.dataTransfer.setData('text/plain', JSON.stringify({
|
|
|
title: component.title,
|
|
|
- data: component.data
|
|
|
+ data: component.data,
|
|
|
+ type: component.type
|
|
|
}))
|
|
|
|
|
|
event.dataTransfer.effectAllowed = 'copy'
|
|
@@ -81,11 +83,14 @@ const openPreview = (component: any) => {
|
|
|
</div>
|
|
|
|
|
|
<div class="component-preview">
|
|
|
+
|
|
|
<Markdown
|
|
|
+ v-if="component.type === 'markdown'"
|
|
|
:content="component.preview"
|
|
|
:plugins="plugin"
|
|
|
class="preview-content"
|
|
|
/>
|
|
|
+ <vue-charts style="width: 100%;height: 200px" :data="component.data" v-if="component.type === 'echarts'"/>
|
|
|
</div>
|
|
|
|
|
|
<div class="component-actions">
|
|
@@ -131,7 +136,9 @@ const openPreview = (component: any) => {
|
|
|
v-if="previewComponent"
|
|
|
>
|
|
|
<div class="preview-dialog-content">
|
|
|
+ <vue-charts style="width: 100%;height: 400px" :data="previewComponent.data" v-if="previewComponent.type === 'echarts'"/>
|
|
|
<Markdown
|
|
|
+ v-if="previewComponent.type === 'markdown'"
|
|
|
:content="previewComponent.data"
|
|
|
:plugins="plugin"
|
|
|
class="full-preview-content"
|