diff --git a/src/components/root/rootProps.ts b/src/components/root/rootProps.ts index 87dc173..151d7c5 100644 --- a/src/components/root/rootProps.ts +++ b/src/components/root/rootProps.ts @@ -134,10 +134,10 @@ export default { * 甘特图表的每一列宽度 */ ganttColumnSize: { - type: String as PropType, + type: String as PropType | number, default: 'normal', validator: (v: GanttColumnSize) => { - return ['small', 'normal', 'large'].includes(v); + return typeof v === 'number' || ['small', 'normal', 'large'].includes(v); } }, diff --git a/src/composables/useGanttWidth.ts b/src/composables/useGanttWidth.ts index 915d434..ee1063a 100644 --- a/src/composables/useGanttWidth.ts +++ b/src/composables/useGanttWidth.ts @@ -21,6 +21,7 @@ export default () => { const ganttColumnWidth = computed(() => { const size = store.$styleBox.ganttColumnSize; + if (typeof size === 'number') return size; return Variables.size.ganttColumnWidth[size][store.ganttHeader.unit]; }); diff --git a/src/typings/size.d.ts b/src/typings/size.d.ts index 16c6c3f..0f524a6 100644 --- a/src/typings/size.d.ts +++ b/src/typings/size.d.ts @@ -1 +1 @@ -declare type GanttColumnSize = 'small' | 'normal' | 'large'; +declare type GanttColumnSize = 'small' | 'normal' | 'large' | number;