mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-05 13:27:28 +08:00
Limit long-lived page and component retention while virtualizing large card views to keep runtime memory lower. Defer heavy editor, chart, workflow, calendar, and icon code so the app loads less JavaScript up front.
41 lines
901 B
TypeScript
41 lines
901 B
TypeScript
declare global {
|
|
interface Window {
|
|
Apex: any
|
|
}
|
|
}
|
|
|
|
export function configureApexChartsTheme(themeName: string) {
|
|
if (typeof window === 'undefined' || !window.Apex) {
|
|
return
|
|
}
|
|
|
|
try {
|
|
const isDark = themeName === 'dark' || themeName === 'transparent'
|
|
|
|
window.Apex.dataLabels = {
|
|
formatter: function (_: number, { seriesIndex, w }: { seriesIndex: number; w: any }) {
|
|
const data = w.config.series[seriesIndex]
|
|
return data.toFixed(data % 1 === 0 ? 0 : 1)
|
|
},
|
|
}
|
|
|
|
window.Apex.legend = {
|
|
labels: {
|
|
useSeriesColors: true,
|
|
},
|
|
}
|
|
|
|
window.Apex.title = {
|
|
style: {
|
|
color: 'rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity))',
|
|
},
|
|
}
|
|
|
|
window.Apex.tooltip = {
|
|
theme: isDark ? 'dark' : 'light',
|
|
}
|
|
} catch (error) {
|
|
console.warn('ApexCharts 全局配置失败:', error)
|
|
}
|
|
}
|