fix: 修改类型报错

This commit is contained in:
MTrun 2022-03-07 15:21:45 +08:00
parent 5b14e3a70f
commit f8785a4505
13 changed files with 43 additions and 27 deletions

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const ImageConfig: ConfigType = { export const ImageConfig: ConfigType = {
key: 'VImage', key: 'VImage',
conKey: 'VCImage',
title: '图片', title: '图片',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.INFORMATION, package: PackagesCategoryEnum.INFORMATION,
node: Image, node: () => Image,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TextCloudConfig: ConfigType = { export const TextCloudConfig: ConfigType = {
key: 'VTextCloud', key: 'VTextCloud',
conKey: 'VCTextCloud',
title: '词云', title: '词云',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.INFORMATION, package: PackagesCategoryEnum.INFORMATION,
node: TextCloud, node: () => TextCloud,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TextCommonConfig: ConfigType = { export const TextCommonConfig: ConfigType = {
key: 'VText', key: 'VText',
conKey: 'VCText',
title: '文字', title: '文字',
category: ChatCategoryEnum.TEXT, category: ChatCategoryEnum.TEXT,
categoryName: ChatCategoryEnumName.TEXT, categoryName: ChatCategoryEnumName.TEXT,
package: PackagesCategoryEnum.INFORMATION, package: PackagesCategoryEnum.INFORMATION,
node: TextCommon, node: () => TextCommon,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TitleBevelAngleConfig: ConfigType = { export const TitleBevelAngleConfig: ConfigType = {
key: 'VTitleBevelAngle', key: 'VTitleBevelAngle',
conKey: 'VCTitleBevelAngle',
title: '斜角标题', title: '斜角标题',
category: ChatCategoryEnum.TITLE, category: ChatCategoryEnum.TITLE,
categoryName: ChatCategoryEnumName.TITLE, categoryName: ChatCategoryEnumName.TITLE,
package: PackagesCategoryEnum.INFORMATION, package: PackagesCategoryEnum.INFORMATION,
node: TitleBevelAngle, node: () => TitleBevelAngle,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TitleCommonConfig: ConfigType = { export const TitleCommonConfig: ConfigType = {
key: 'VText', key: 'VText',
conKey: 'VCText',
title: '普通标题', title: '普通标题',
category: ChatCategoryEnum.TITLE, category: ChatCategoryEnum.TITLE,
categoryName: ChatCategoryEnumName.TITLE, categoryName: ChatCategoryEnumName.TITLE,
package: PackagesCategoryEnum.INFORMATION, package: PackagesCategoryEnum.INFORMATION,
node: TitleCommon, node: () => TitleCommon,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TitleProConfig: ConfigType = { export const TitleProConfig: ConfigType = {
key: 'VTitlePro', key: 'VTitlePro',
conKey: 'VCTitlePro',
title: '中心标题', title: '中心标题',
category: ChatCategoryEnum.TITLE, category: ChatCategoryEnum.TITLE,
categoryName: ChatCategoryEnumName.TITLE, categoryName: ChatCategoryEnumName.TITLE,
package: PackagesCategoryEnum.INFORMATION, package: PackagesCategoryEnum.INFORMATION,
node: TitlePro, node: () => TitlePro,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const TableCategoryConfig: ConfigType = { export const TableCategoryConfig: ConfigType = {
key: 'VTableCategory', key: 'VTableCategory',
conKey: 'VCableCategory',
title: '归类表格', title: '归类表格',
category: ChatCategoryEnum.TABLE, category: ChatCategoryEnum.TABLE,
categoryName: ChatCategoryEnumName.TABLE, categoryName: ChatCategoryEnumName.TABLE,
package: PackagesCategoryEnum.TABLES, package: PackagesCategoryEnum.TABLES,
node: TableCategory, node: () => TableCategory,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -6,11 +6,12 @@ import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const TableCommonConfig: ConfigType = { export const TableCommonConfig: ConfigType = {
key: 'VTableCommon', key: 'VTableCommon',
conKey: 'VCTableCommon',
title: '表格', title: '表格',
category: ChatCategoryEnum.TABLE, category: ChatCategoryEnum.TABLE,
categoryName: ChatCategoryEnumName.TABLE, categoryName: ChatCategoryEnumName.TABLE,
package: PackagesCategoryEnum.TABLES, package: PackagesCategoryEnum.TABLES,
node: TableCommon, node: () => TableCommon,
conNode: () => Configuration, conNode: () => Configuration,
image image
} }

View File

@ -10,7 +10,7 @@ import { CreateComponentType } from '@/packages/index.d'
* @param app * @param app
*/ */
export const setupPreviewPackages = (app: App) => { export const setupPreviewPackages = (app: App) => {
if(!document.location.hash.includes('preview')) return if (document.location.hash.includes('preview')) {
const localStorageInfo = getLocalStorageInfo() const localStorageInfo = getLocalStorageInfo()
if (!localStorageInfo) return if (!localStorageInfo) return
localStorageInfo.componentList.forEach(async (e: CreateComponentType) => { localStorageInfo.componentList.forEach(async (e: CreateComponentType) => {
@ -20,6 +20,7 @@ export const setupPreviewPackages = (app: App) => {
} }
}) })
} }
}
/** /**
* *

View File

@ -24,16 +24,16 @@
import { toRefs, Ref, reactive } from 'vue' import { toRefs, Ref, reactive } from 'vue'
import { renderIcon, goDialog, goHome } from '@/utils' import { renderIcon, goDialog, goHome } from '@/utils'
import { icon } from '@/plugins' import { icon } from '@/plugins'
const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon } = icon.ionicons5
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore' import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d' import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
import { useRemoveKeyboard } from '../hooks/useKeyboard.hook' import { useRemoveKeyboard } from '../hooks/useKeyboard.hook'
const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon } = icon.ionicons5
const { setItem } = useChartLayoutStore() const { setItem } = useChartLayoutStore()
const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore()) const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore())
type ItemType = { interface ItemType {
key: string key: ChartLayoutStoreEnum
select: Ref<boolean> | boolean select: Ref<boolean> | boolean
title: string title: string
icon: any icon: any

View File

@ -1,4 +1,5 @@
import { PickCreateComponentType } from '@/packages/index.d' import { PickCreateComponentType } from '@/packages/index.d'
import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
type AttrType = PickCreateComponentType<'attr'> type AttrType = PickCreateComponentType<'attr'>
@ -19,3 +20,12 @@ export const useSizeStyle = (attr: AttrType, scale?: number) => {
} }
return sizeStyle return sizeStyle
} }
export const useEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => {
return {
position: 'relative',
width: canvas.width ? `${canvas.width || 100}px` : '100%',
height: canvas.height ? `${canvas.height}px` : '100%',
border: '1px solid red'
}
}

View File

@ -17,6 +17,7 @@ import { usePreviewScale } from '@/hooks/index'
import { RenderList } from './components/RenderList/index' import { RenderList } from './components/RenderList/index'
import { ChartEditStorageType } from './index.d' import { ChartEditStorageType } from './index.d'
import { getLocalStorageInfo } from './utils/index' import { getLocalStorageInfo } from './utils/index'
import { useEditCanvasConfigStyle } from './hooks/useStyle.hook'
const previewRef = ref() const previewRef = ref()
@ -25,13 +26,8 @@ const localStorageInfo: ChartEditStorageType = getLocalStorageInfo() as ChartEdi
const width = ref(localStorageInfo?.editCanvasConfig.width) const width = ref(localStorageInfo?.editCanvasConfig.width)
const height = ref(localStorageInfo?.editCanvasConfig.height) const height = ref(localStorageInfo?.editCanvasConfig.height)
const previewRefStyle = computed(() => { const previewRefStyle: any = computed(() => {
return { return useEditCanvasConfigStyle(localStorageInfo.editCanvasConfig)
position: 'relative',
width: width.value ? `${width.value || 100}px` : '100%',
height: height.value ? `${height.value}px` : '100%',
border: '1px solid red'
}
}) })
if (!localStorageInfo) { if (!localStorageInfo) {

View File

@ -6,6 +6,7 @@ export interface ChartEditStorageType extends ChartEditStorage {
id: string id: string
} }
// 根据路由 id 获取存储数据的信息
export const getLocalStorageInfo = () => { export const getLocalStorageInfo = () => {
const urlHash = document.location.hash const urlHash = document.location.hash
const toPathArray = urlHash.split('/') const toPathArray = urlHash.split('/')