diff --git a/src/components/desktop/PieChart.vue b/src/components/desktop/PieChart.vue index 33752399..f51d6d30 100644 --- a/src/components/desktop/PieChart.vue +++ b/src/components/desktop/PieChart.vue @@ -24,9 +24,7 @@ interface DesktopPieChartDataItem extends CommonPieChartDataItem { selected: boolean; } -interface DesktopPieChartProps extends CommonPieChartProps {} - -const props = defineProps(); +const props = defineProps(); const emit = defineEmits<{ (e: 'click', value: Record): void; diff --git a/src/components/mobile/PieChart.vue b/src/components/mobile/PieChart.vue index c5bb2f63..8c1426b1 100644 --- a/src/components/mobile/PieChart.vue +++ b/src/components/mobile/PieChart.vue @@ -85,8 +85,6 @@ import { type CommonPieChartDataItem, type CommonPieChartProps, usePieChartBase import type { ColorValue } from '@/core/color.ts'; import { DEFAULT_ICON_COLOR } from '@/consts/color.ts'; -interface MobilePieChartDataItem extends CommonPieChartDataItem {} - interface MobilePieChartProps extends CommonPieChartProps { showCenterText?: boolean; showSelectedItemInfo?: boolean; @@ -161,12 +159,12 @@ function getColorStyle(color: ColorValue, additionalFieldName?: string): Record< return ret; } -function getItemStrokeDash(item: MobilePieChartDataItem): string { +function getItemStrokeDash(item: CommonPieChartDataItem): string { const length = item.actualPercent * circumference; return `${length} ${circumference - length}`; } -function getItemDashOffset(item: MobilePieChartDataItem, items: MobilePieChartDataItem[], offset?: number): number { +function getItemDashOffset(item: CommonPieChartDataItem, items: CommonPieChartDataItem[], offset?: number): number { let allPreviousPercent = 0; for (let i = 0; i < items.length; i++) { @@ -193,7 +191,7 @@ function getItemDashOffset(item: MobilePieChartDataItem, items: MobilePieChartDa return circumference - allPreviousLength + offset; } -const selectedItem = computed(() => { +const selectedItem = computed(() => { if (!validItems.value || !validItems.value.length) { return null; } @@ -221,7 +219,7 @@ function switchSelectedItem(offset: number): void { selectedIndex.value = newSelectedIndex % validItems.value.length; } -function clickItem(item: MobilePieChartDataItem): void { +function clickItem(item: CommonPieChartDataItem): void { if (props.enableClickItem) { emit('click', item.sourceItem); }