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 = {
key: 'VImage',
conKey: 'VCImage',
title: '图片',
category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.INFORMATION,
node: Image,
node: () => Image,
conNode: () => Configuration,
image
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
import { PickCreateComponentType } from '@/packages/index.d'
import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
type AttrType = PickCreateComponentType<'attr'>
@ -19,3 +20,12 @@ export const useSizeStyle = (attr: AttrType, scale?: number) => {
}
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 { ChartEditStorageType } from './index.d'
import { getLocalStorageInfo } from './utils/index'
import { useEditCanvasConfigStyle } from './hooks/useStyle.hook'
const previewRef = ref()
@ -25,13 +26,8 @@ const localStorageInfo: ChartEditStorageType = getLocalStorageInfo() as ChartEdi
const width = ref(localStorageInfo?.editCanvasConfig.width)
const height = ref(localStorageInfo?.editCanvasConfig.height)
const previewRefStyle = computed(() => {
return {
position: 'relative',
width: width.value ? `${width.value || 100}px` : '100%',
height: height.value ? `${height.value}px` : '100%',
border: '1px solid red'
}
const previewRefStyle: any = computed(() => {
return useEditCanvasConfigStyle(localStorageInfo.editCanvasConfig)
})
if (!localStorageInfo) {

View File

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