mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-10-15 04:09:14 +00:00
feat: implement the Dark Theme (#334)
This commit is contained in:
@@ -30,6 +30,8 @@ import { useDebounceFn } from "@vueuse/core";
|
||||
import { useEventListener } from "./useEventListener";
|
||||
import { useBreakpoint } from "./useBreakpoint";
|
||||
import echarts from "@/utils/echarts";
|
||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||
import { Themes } from "@/constants/data";
|
||||
|
||||
export type ECOption = echarts.ComposeOption<
|
||||
| BarSeriesOption
|
||||
@@ -44,8 +46,9 @@ export type ECOption = echarts.ComposeOption<
|
||||
>;
|
||||
|
||||
export function useECharts(elRef: Ref<HTMLDivElement>, theme: "light" | "dark" | "default" = "default"): Indexable {
|
||||
const appStore = useAppStoreWithOut();
|
||||
const getDarkMode = computed(() => {
|
||||
return theme === "default" ? "light" : theme;
|
||||
return appStore.theme === "default" ? Themes.Light : theme;
|
||||
});
|
||||
let chartInstance: Nullable<echarts.ECharts> = null;
|
||||
let resizeFn: Fn = resize;
|
||||
@@ -55,7 +58,7 @@ export function useECharts(elRef: Ref<HTMLDivElement>, theme: "light" | "dark" |
|
||||
resizeFn = useDebounceFn(resize, 200);
|
||||
|
||||
const getOptions = computed(() => {
|
||||
if (getDarkMode.value !== "dark") {
|
||||
if (getDarkMode.value !== Themes.Dark) {
|
||||
return cacheOptions.value as ECOption;
|
||||
}
|
||||
return {
|
||||
|
Reference in New Issue
Block a user