From b73893a6af93d1f144c03c7a52b98bb1fef858b8 Mon Sep 17 00:00:00 2001 From: pengjian Date: Mon, 30 Jan 2023 17:37:56 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=BD=AE=E6=92=AD=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0=E8=BD=AE?= =?UTF-8?q?=E6=92=AD=E6=96=B9=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Tables/Tables/TableScrollBoard/config.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/packages/components/Tables/Tables/TableScrollBoard/config.vue b/src/packages/components/Tables/Tables/TableScrollBoard/config.vue index 834cfb5b..1aec6363 100644 --- a/src/packages/components/Tables/Tables/TableScrollBoard/config.vue +++ b/src/packages/components/Tables/Tables/TableScrollBoard/config.vue @@ -40,6 +40,15 @@ + + + From 4e5c921bf2f48b96ebd0a680807ae5384326dbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=94=E5=90=AC=E9=A3=8E=E5=90=9F720?= Date: Thu, 2 Feb 2023 09:34:50 +0000 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E5=8F=B3=E4=BE=A7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=85=8D=E7=BD=AE=E5=86=85=E5=AE=B9=E8=A2=AB=E6=8C=A4?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 且听风吟720 --- src/views/chart/index.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/chart/index.vue b/src/views/chart/index.vue index 89c60d95..856ddea2 100644 --- a/src/views/chart/index.vue +++ b/src/views/chart/index.vue @@ -14,8 +14,10 @@ - - +
+ + +
From a7b98fe3d66043854d5731cee8b130229e2b5dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Thu, 2 Feb 2023 20:54:02 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E5=87=BD=E6=95=B0=EF=BC=8C=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E9=94=99=E8=AF=AF=E6=8D=95=E8=8E=B7=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 6 ++++-- src/plugins/index.ts | 1 + src/plugins/initFunction.ts | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/plugins/initFunction.ts diff --git a/src/main.ts b/src/main.ts index cf9b86df..d85d46cb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import App from './App.vue' import router, { setupRouter } from '@/router' import i18n from '@/i18n/index' import { setupStore } from '@/store' -import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins' +import { setupNaive, setupDirectives, setupCustomComponents, initFunction } from '@/plugins' import { GoAppProvider } from '@/components/GoAppProvider/index' import { setHtmlTheme } from '@/utils' @@ -53,4 +53,6 @@ async function appInit() { window['$vue'] = app } -void appInit() +await appInit() + +await initFunction() diff --git a/src/plugins/index.ts b/src/plugins/index.ts index c500f63a..d1ac07ba 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -2,3 +2,4 @@ export { setupNaive } from '@/plugins/naive' export { setupDirectives } from '@/plugins/directives' export { setupCustomComponents } from '@/plugins/customComponents' export { icon } from '@/plugins/icon' +export { initFunction } from '@/plugins/initFunction' diff --git a/src/plugins/initFunction.ts b/src/plugins/initFunction.ts new file mode 100644 index 00000000..1df1db45 --- /dev/null +++ b/src/plugins/initFunction.ts @@ -0,0 +1,9 @@ +/** + * * 页面初始化就执行的函数 + */ +export const initFunction = async () => { + // 捕获全局错误 + window.addEventListener("unhandledrejection", event => { + console.warn(`UNHANDLED PROMISE REJECTION: ${event.reason}`); + }); +} \ No newline at end of file From 4ec1bbd91263cbacd750aaa8a5ad665ec8aee663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 8 Feb 2023 16:38:38 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E9=81=97=E6=BC=8F=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/storage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 5b9f6922..5804ae8d 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -44,7 +44,7 @@ export const clearLocalStorage = (name: string) => { */ export const setSessionStorage = (k: string, v: T) => { try { - window.sessionStorage.setItem(k, JSON.stringify(v)) + window.sessionStorage.setItem(k, JSONStringify(v)) } catch (error) { return false } From d7aa41094b4b05f6574adac0e241a1fbd428010b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Thu, 9 Feb 2023 11:29:23 +0800 Subject: [PATCH 5/8] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=99=A8=E4=BD=93=E9=AA=8C=EF=BC=8C=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charts/Bars/CapsuleChart/index.vue | 25 +++++++++++-------- .../ChartDataMonacoEditor/index.vue | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/packages/components/Charts/Bars/CapsuleChart/index.vue b/src/packages/components/Charts/Bars/CapsuleChart/index.vue index 804ae0dc..73a6ae0d 100644 --- a/src/packages/components/Charts/Bars/CapsuleChart/index.vue +++ b/src/packages/components/Charts/Bars/CapsuleChart/index.vue @@ -122,23 +122,28 @@ const calcData = (data: any, type?: string) => { // 数据解析 const calcCapsuleLengthAndLabelData = (dataset: any) => { - const { source } = dataset - if (!source.length) return + try { + const { source } = dataset + if (!source || !source.length) return - state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight) - const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]]) + state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight) + const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]]) - const maxValue = Math.max(...capsuleValue) + const maxValue = Math.max(...capsuleValue) - state.capsuleValue = capsuleValue + state.capsuleValue = capsuleValue - state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0)) + state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0)) - const oneFifth = maxValue / 5 + const oneFifth = maxValue / 5 - const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth)))) + const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth)))) - state.labelData = labelData + state.labelData = labelData + + } catch (error) { + console.warn(error); + } } const numberSizeHandle = (val: string | number) => { diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue index a0078f15..205f3328 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataMonacoEditor/index.vue @@ -150,7 +150,7 @@ const filterRes = computed(() => { } catch (error) { // eslint-disable-next-line vue/no-side-effects-in-computed-properties errorFlag.value = true - return '过滤函数错误' + return `过滤函数错误,日志:${error}` } }) From f21c9f12468b81d832510c474c98de57b2e3e3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Tue, 14 Feb 2023 21:12:30 +0800 Subject: [PATCH 6/8] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=20iframe=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/components/Informations/Mores/Iframe/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/components/Informations/Mores/Iframe/config.ts b/src/packages/components/Informations/Mores/Iframe/config.ts index 2e96c211..a9cf94c6 100644 --- a/src/packages/components/Informations/Mores/Iframe/config.ts +++ b/src/packages/components/Informations/Mores/Iframe/config.ts @@ -14,7 +14,7 @@ export const option = { export default class Config extends PublicConfigClass implements CreateComponentType { public key = IframeConfig.key - public attr = { ...chartInitConfig, w: 800, h: 800, zIndex: -1 } + public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } public chartConfig = cloneDeep(IframeConfig) public option = cloneDeep(option) } From 4f2609a121a44536219dd7fe8d5bd7d5d8b32e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 15 Feb 2023 09:20:48 +0800 Subject: [PATCH 7/8] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=86=85?= =?UTF-8?q?=E5=AD=98=E6=B3=84=E6=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useChartDataFetch.hook.ts | 3 ++- .../components/Charts/Maps/MapBase/index.vue | 4 ++-- .../components/Charts/Mores/Heatmap/index.vue | 4 ++-- .../components/Charts/Mores/Radar/index.vue | 4 ++-- .../components/Charts/Mores/TreeMap/index.vue | 4 ++-- .../Informations/Mores/WordCloud/index.vue | 4 ++-- src/packages/public/chart.ts | 13 +++++++++++++ 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/hooks/useChartDataFetch.hook.ts b/src/hooks/useChartDataFetch.hook.ts index 0138d1b7..ed82edf5 100644 --- a/src/hooks/useChartDataFetch.hook.ts +++ b/src/hooks/useChartDataFetch.hook.ts @@ -6,6 +6,7 @@ import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { RequestDataTypeEnum } from '@/enums/httpEnum' import { isPreview, newFunctionHandle, intervalUnitHandle } from '@/utils' +import { setOption } from '@/packages/public/chart' // 获取类型 type ChartEditStoreType = typeof useChartEditStore @@ -34,7 +35,7 @@ export const useChartDataFetch = ( const echartsUpdateHandle = (dataset: any) => { if (chartFrame === ChartFrameEnum.ECHARTS) { if (vChartRef.value) { - vChartRef.value.setOption({ dataset: dataset }) + setOption(vChartRef.value, { dataset: dataset }) } } } diff --git a/src/packages/components/Charts/Maps/MapBase/index.vue b/src/packages/components/Charts/Maps/MapBase/index.vue index f927e64a..7a66753d 100644 --- a/src/packages/components/Charts/Maps/MapBase/index.vue +++ b/src/packages/components/Charts/Maps/MapBase/index.vue @@ -11,7 +11,7 @@ import { use, registerMap } from 'echarts/core' import { EffectScatterChart, MapChart } from 'echarts/charts' import { CanvasRenderer } from 'echarts/renderers' import { useChartDataFetch } from '@/hooks' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { isPreview } from '@/utils' import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json' @@ -76,7 +76,7 @@ registerMapInitAsync() // 手动触发渲染 const vEchartsSetOption = () => { option.value = props.chartConfig.option - vChartRef.value?.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } // 更新数据处理 diff --git a/src/packages/components/Charts/Mores/Heatmap/index.vue b/src/packages/components/Charts/Mores/Heatmap/index.vue index 45cb810c..3dcd91aa 100644 --- a/src/packages/components/Charts/Mores/Heatmap/index.vue +++ b/src/packages/components/Charts/Mores/Heatmap/index.vue @@ -10,7 +10,7 @@ import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import { HeatmapChart } from 'echarts/charts' import { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { CreateComponentType } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -68,7 +68,7 @@ const dataSetHandle = (dataset: typeof dataJson) => { props.chartConfig.option.series[0].data = seriesData } if (vChartRef.value && isPreview()) { - vChartRef.value.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } } diff --git a/src/packages/components/Charts/Mores/Radar/index.vue b/src/packages/components/Charts/Mores/Radar/index.vue index 2e523267..8dad3571 100644 --- a/src/packages/components/Charts/Mores/Radar/index.vue +++ b/src/packages/components/Charts/Mores/Radar/index.vue @@ -10,7 +10,7 @@ import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import { RadarChart } from 'echarts/charts' import { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { CreateComponentType } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -50,7 +50,7 @@ const dataSetHandle = (dataset: typeof dataJson) => { props.chartConfig.option.radar.indicator = dataset.radarIndicator } if (vChartRef.value && isPreview()) { - vChartRef.value.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } } diff --git a/src/packages/components/Charts/Mores/TreeMap/index.vue b/src/packages/components/Charts/Mores/TreeMap/index.vue index 7964f174..37eb4fb1 100644 --- a/src/packages/components/Charts/Mores/TreeMap/index.vue +++ b/src/packages/components/Charts/Mores/TreeMap/index.vue @@ -10,7 +10,7 @@ import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import { TreemapChart } from 'echarts/charts' import { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { CreateComponentType } from '@/packages/index.d' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' @@ -42,7 +42,7 @@ const option = computed(() => { const dataSetHandle = (dataset: typeof dataJson) => { if (dataset) { props.chartConfig.option.series[0].data = dataset - vChartRef.value?.setOption(props.chartConfig.option) + setOption(vChartRef.value, props.chartConfig.option) } } diff --git a/src/packages/components/Informations/Mores/WordCloud/index.vue b/src/packages/components/Informations/Mores/WordCloud/index.vue index 4c9626e3..a5c8a592 100644 --- a/src/packages/components/Informations/Mores/WordCloud/index.vue +++ b/src/packages/components/Informations/Mores/WordCloud/index.vue @@ -16,7 +16,7 @@ import 'echarts-wordcloud' import { use } from 'echarts/core' import { CanvasRenderer } from 'echarts/renderers' import config, { includes } from './config' -import { mergeTheme } from '@/packages/public/chart' +import { mergeTheme, setOption } from '@/packages/public/chart' import { useChartDataFetch } from '@/hooks' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { isPreview } from '@/utils' @@ -49,7 +49,7 @@ const option = computed(() => { const dataSetHandle = (dataset: typeof dataJson) => { try { dataset && (props.chartConfig.option.series[0].data = dataset) - vChartRef.value && isPreview() && vChartRef.value.setOption(props.chartConfig.option) + vChartRef.value && isPreview() && setOption(vChartRef.value, props.chartConfig.option) } catch (error) { console.log(error) } diff --git a/src/packages/public/chart.ts b/src/packages/public/chart.ts index d36a850e..5ed7785e 100644 --- a/src/packages/public/chart.ts +++ b/src/packages/public/chart.ts @@ -2,6 +2,7 @@ import merge from 'lodash/merge' import pick from 'lodash/pick' import { EchartsDataType } from '../index.d' import { globalThemeJson } from '@/settings/chartThemes/index' +import type VChart from 'vue-echarts' /** * * 合并 color 和全局配置项 @@ -33,3 +34,15 @@ export const setData = (option: any, data: EchartsDataType) => { option.dataset = data return option } + +/** + * * 配置公共 setOption 方法 + * @param instance + * @param data + */ +export const setOption = (instance: T, data: D) => { + if (!instance) return + const option = instance.getOption() + option.dataset = null + instance.setOption(data) +} From fc58df2148cf9d6008b3c8eca0651fc124c1f6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Wed, 15 Feb 2023 14:24:56 +0800 Subject: [PATCH 8/8] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20public=20?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=85=8D=E7=BD=AE=E9=A1=B9preview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Informations/Texts/TextBarrage/config.ts | 2 +- src/packages/index.d.ts | 4 ++++ src/packages/public/publicConfig.ts | 4 ++++ .../preview/components/PreviewRenderGroup/index.vue | 4 ++-- .../preview/components/PreviewRenderList/index.vue | 8 +++----- src/views/preview/utils/style.ts | 12 ++++++++++++ 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/packages/components/Informations/Texts/TextBarrage/config.ts b/src/packages/components/Informations/Texts/TextBarrage/config.ts index eb04f096..aefc4331 100644 --- a/src/packages/components/Informations/Texts/TextBarrage/config.ts +++ b/src/packages/components/Informations/Texts/TextBarrage/config.ts @@ -15,7 +15,6 @@ export const FontWeightObject = { } export const option = { - dataset: '让数字化看得见', fontSize: 32, fontColor: '#ffffff', @@ -39,4 +38,5 @@ export default class Config extends PublicConfigClass implements CreateComponent public attr = { ...chartInitConfig, w: 500, h: 70, zIndex: -1 } public chartConfig = cloneDeep(TextBarrageConfig) public option = cloneDeep(option) + public preview = { overFlowHidden: true } } diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts index e1f626b3..d8ef0bdd 100644 --- a/src/packages/index.d.ts +++ b/src/packages/index.d.ts @@ -114,6 +114,10 @@ export interface PublicConfigType { // 动画 animations: string[] } + preview?: { + // 预览超出隐藏 + overFlowHidden?: boolean + } filter?: string status: StatusType events: { diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts index c4288638..10b3a10b 100644 --- a/src/packages/public/publicConfig.ts +++ b/src/packages/public/publicConfig.ts @@ -78,6 +78,10 @@ export class PublicConfigClass implements PublicConfigType { // 动画 animations: [] } + // 预览 + public preview = { + overFlowHidden: false + } // 状态 public status = { lock: false, diff --git a/src/views/preview/components/PreviewRenderGroup/index.vue b/src/views/preview/components/PreviewRenderGroup/index.vue index e6e22d92..354fa29c 100644 --- a/src/views/preview/components/PreviewRenderGroup/index.vue +++ b/src/views/preview/components/PreviewRenderGroup/index.vue @@ -9,6 +9,7 @@ ...getFilterStyle(item.styles), ...getTransformStyle(item.styles), ...getStatusStyle(item.status), + ...getPreviewConfigStyle(item.preview), ...getBlendModeStyle(item.styles) as any }" > @@ -28,7 +29,7 @@ import { PropType } from 'vue' import { CreateComponentGroupType } from '@/packages/index.d' import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' -import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils' +import { getSizeStyle, getComponentAttrStyle, getStatusStyle, getPreviewConfigStyle } from '../../utils' import { useLifeHandler } from '@/hooks' const props = defineProps({ @@ -54,6 +55,5 @@ const props = defineProps({ diff --git a/src/views/preview/components/PreviewRenderList/index.vue b/src/views/preview/components/PreviewRenderList/index.vue index ee5ea39c..eca587aa 100644 --- a/src/views/preview/components/PreviewRenderList/index.vue +++ b/src/views/preview/components/PreviewRenderList/index.vue @@ -2,13 +2,14 @@
@@ -43,7 +44,7 @@ import { PreviewRenderGroup } from '../PreviewRenderGroup/index' import { CreateComponentGroupType } from '@/packages/index.d' import { chartColors } from '@/settings/chartThemes/index' import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils' -import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils' +import { getSizeStyle, getComponentAttrStyle, getStatusStyle, getPreviewConfigStyle } from '../../utils' import { useLifeHandler } from '@/hooks' // 初始化数据池 @@ -78,8 +79,5 @@ onMounted(() => { diff --git a/src/views/preview/utils/style.ts b/src/views/preview/utils/style.ts index 6cd25cba..945aa8c0 100644 --- a/src/views/preview/utils/style.ts +++ b/src/views/preview/utils/style.ts @@ -3,6 +3,7 @@ import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditSt type AttrType = PickCreateComponentType<'attr'> type StatusType = PickCreateComponentType<'status'> +type PreviewConfig = PickCreateComponentType<'preview'> // 设置位置 export const getComponentAttrStyle = (attr: AttrType, index: number) => { @@ -29,6 +30,17 @@ export const getStatusStyle = (attr: StatusType) => { } } +// 设置预览配置样式 +export const getPreviewConfigStyle = (previewConfig: PreviewConfig) => { + const previewStyle: Partial = {} + if (previewConfig) { + if (previewConfig.overFlowHidden) { + previewStyle.overflow = 'hidden' + } + } + return previewStyle +} + // 全局样式 export const getEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => { // 背景