🐛 修复主题切换异常

This commit is contained in:
BTMuli
2025-11-22 01:08:09 +08:00
parent dce90b64a6
commit 3a542ead17
4 changed files with 8 additions and 4 deletions

View File

@@ -7,6 +7,7 @@
:theme="echartsTheme"
:init-options="{ locale: 'ZH' }"
:style="{ height: chartHeight }"
:key="`gro-chart-calendar-${echartsTheme}`"
/>
</template>
<script lang="ts" setup>
@@ -57,7 +58,7 @@ type EChartsOption = ComposeOption<
const props = defineProps<GachaChartCalendarProps>();
const { theme } = storeToRefs(useAppStore());
const chartOptions = shallowRef<EChartsOption>({});
const chartOptions = shallowRef<EChartsOption>();
const yearCount = shallowRef<number>(1); // 默认至少1年避免高度为0
const echartsTheme = computed<"dark" | "light">(() => (theme.value === "dark" ? "dark" : "light"));

View File

@@ -6,6 +6,7 @@
autoresize
:theme="echartsTheme"
:init-options="{ locale: 'ZH' }"
:key="`gro-chart-overview-${echartsTheme}`"
/>
</template>
<script lang="ts" setup>

View File

@@ -6,6 +6,7 @@
autoresize
:theme="echartsTheme"
:init-options="{ locale: 'ZH' }"
:key="`gro-chart-stackbar-${echartsTheme}`"
/>
</template>
<script lang="ts" setup>

View File

@@ -29,15 +29,16 @@ import { ref } from "vue";
type GachaOverviewEchartsProps = { uid: string; gachaType?: string };
type ChartsType = "overview" | "calendar" | "stackBar";
type ChartItem = { label: string; value: ChartsType };
type SelectType<T> = { label: string; value: T };
defineProps<GachaOverviewEchartsProps>();
const chartTypes: Array<ChartItem> = [
const chartTypes: Array<SelectType<ChartsType>> = [
{ label: "祈愿分析", value: "overview" },
{ label: "祈愿日历", value: "calendar" },
{ label: "祈愿柱状图", value: "stackBar" },
];
// TODO: 分卡池选择图表
const curChartType = ref<ChartsType>("overview");
</script>
@@ -70,8 +71,8 @@ const curChartType = ref<ChartsType>("overview");
}
.gro-chart-container {
overflow: hidden auto;
width: 100%;
flex: 1;
overflow: hidden auto;
}
</style>