fix: 修改引入方式,去除config文件上的node指向

This commit is contained in:
MTrun
2022-03-10 14:12:26 +08:00
parent 06caa046fa
commit 87b033c633
18 changed files with 37 additions and 69 deletions
@@ -25,6 +25,7 @@ import { MacOsControlBtn } from '@/components/MacOsControlBtn/index'
import { componentInstall } from '@/utils'
import { DragKeyEnum } from '@/enums/editPageEnum'
import { ConfigType } from '@/packages/index.d'
import { fetchConfigComponent, fetchChartComponent } from '@/packages/index'
import omit from 'lodash/omit'
defineProps({
@@ -37,10 +38,10 @@ defineProps({
// 拖拽处理
const handleDragStart = (e: DragEvent, item: ConfigType) => {
// 动态注册图表组件
componentInstall(item.key, item.node())
componentInstall(item.conKey, item.conNode())
componentInstall(item.chartKey, fetchChartComponent(item))
componentInstall(item.conKey, fetchConfigComponent(item))
// 将配置项绑定到拖拽属性上
e!.dataTransfer!.setData(DragKeyEnum.DROG_KEY, JSON.stringify(omit(item, ['node', 'conNode', 'image'])))
e!.dataTransfer!.setData(DragKeyEnum.DROG_KEY, JSON.stringify(omit(item, ['image'])))
}
</script>
@@ -30,9 +30,10 @@ export const handleDrag = async (e: DragEvent) => {
// 设置拖拽状态
chartEditStore.setEditCanvas(EditCanvasTypeEnum.IS_CREATE, false)
const dropData: Exclude<ConfigType, ['node', 'image']> = JSON.parse(
const dropData: Exclude<ConfigType, ['image']> = JSON.parse(
drayDataString
)
// 创建新图表组件
let newComponent: CreateComponentType = await createComponent(dropData)
+1 -1
View File
@@ -28,7 +28,7 @@
>
<component
class="edit-content-chart"
:is="item.key"
:is="item.chartConfig.chartKey"
:chartConfig="item"
:themeSetting="themeSetting"
:themeColor="themeColor"