fix: 处理 TS 报错

This commit is contained in:
奔跑的面条
2022-08-15 11:43:32 +08:00
parent bad7e37f5a
commit 09ebd67c37
7 changed files with 27 additions and 49 deletions
@@ -24,8 +24,8 @@
<n-scrollbar style="max-height: 500px">
<div
class="list-item go-flex-items-center go-ellipsis-1"
v-for="item in options"
:key="item.key"
v-for="(item, index) in options"
:key="index"
:title="item.label"
>
<n-icon
@@ -66,6 +66,7 @@ import {
HistoryTargetTypeEnum,
HistoryActionTypeEnum,
} from '@/store/modules/chartHistoryStore/chartHistoryStore.d'
import { isArray } from 'node_modules/_@types_lodash@4.14.182@@types/lodash'
const {
DesktopOutlineIcon,
@@ -127,7 +128,6 @@ const options = computed(() => {
const options = backStack.map((e: HistoryItemType) => {
return {
label: labelHandle(e),
key: e.id,
icon: iconHandle(e),
}
})
+2 -2
View File
@@ -24,11 +24,11 @@
<!-- 图表 -->
<div v-for="(item, index) in chartEditStore.getComponentList" :key="item.id">
<!-- 分组 -->
<edit-group v-if="item.isGroup" :groupData="item" :groupIndex="index"></edit-group>
<edit-group v-if="item.isGroup" :groupData="(item as CreateComponentGroupType)" :groupIndex="index"></edit-group>
<!-- 单组件 -->
<edit-shape-box
v-if="!item.isGroup"
v-else
:data-id="item.id"
:index="index"
:style="useComponentStyle(item.attr, index)"
+2 -2
View File
@@ -51,7 +51,7 @@ export const useSync = () => {
// 重新创建是为了处理类种方法消失的问题
const create = async (e: CreateComponentType, callBack?: (e: CreateComponentType) => void) => {
// 补充 class 上的方法
let newComponent: CreateComponentType = await createComponent(e.chartConfig as ConfigType)
let newComponent: CreateComponentType = await createComponent(e.chartConfig)
if (callBack) {
callBack(Object.assign(newComponent, { ...e, id: getUUID() }))
} else {
@@ -82,7 +82,7 @@ export const useSync = () => {
} else {
// 非组件(顺便排除脏数据)
if (key !== 'editCanvasConfig' && key !== 'requestGlobalConfig') return
Object.assign((chartEditStore as any)[key], projectData[key])
Object.assign(chartEditStore[key], projectData[key])
}
}
}
@@ -44,8 +44,6 @@ const props = defineProps({
required: true
}
})
console.log(props.groupData)
</script>
<style lang="scss" scoped>
@@ -13,7 +13,7 @@
<!-- 分组 -->
<preview-render-group
v-if="item.isGroup"
:groupData="item"
:groupData="(item as CreateComponentGroupType)"
:groupIndex="index"
:themeSetting="themeSetting"
:themeColor="themeColor"
@@ -21,6 +21,7 @@
<!-- 单组件 -->
<component
v-else
:is="item.chartConfig.chartKey"
:chartConfig="item"
:themeSetting="themeSetting"
@@ -34,6 +35,7 @@
import { PropType, computed } from 'vue'
import { ChartEditStorageType } from '../../index.d'
import { PreviewRenderGroup } from '../PreviewRenderGroup/index'
import { CreateComponentGroupType } from '@/packages/index.d'
import { chartColors } from '@/settings/chartThemes/index'
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
import { getSizeStyle, getComponentAttrStyle } from '../../utils'