|
@@ -1,10 +1,11 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, computed, onUnmounted } from 'vue'
|
|
|
+import { ref, computed, onUnmounted, watch } from 'vue'
|
|
|
import { Delete, Edit } from '@element-plus/icons-vue'
|
|
|
import Markdown from '/@/components/markdown/Markdown.vue'
|
|
|
import type { MarkdownDashBoard, Position, Size, Content, ResizeType } 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()]
|
|
|
|
|
@@ -217,6 +218,16 @@ onUnmounted(() => {
|
|
|
document.removeEventListener('mousemove', handleResize)
|
|
|
document.removeEventListener('mouseup', stopResize)
|
|
|
})
|
|
|
+
|
|
|
+const charts = ref()
|
|
|
+
|
|
|
+watch(()=> props.card.w, () => {
|
|
|
+ charts.value?.resize()
|
|
|
+})
|
|
|
+watch(()=> props.card.h, () => {
|
|
|
+ charts.value?.resize()
|
|
|
+})
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -237,10 +248,12 @@ onUnmounted(() => {
|
|
|
<!-- 卡片内容 -->
|
|
|
<div class="card-body">
|
|
|
<Markdown
|
|
|
+ v-if="card.type === 'markdown'"
|
|
|
:content="card.data"
|
|
|
:plugins="plugin"
|
|
|
class="markdown-content"
|
|
|
/>
|
|
|
+ <vue-charts ref="charts" style="width: 100%;height: 100%" :data="card.data" v-if="card.type === 'echarts'"/>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
|