feat: make it possible to dynamically change provide values for Vue 2

This commit is contained in:
Justineo
2022-12-17 01:23:29 +08:00
parent 9491a904a0
commit ec124f4bf7
10 changed files with 106 additions and 42 deletions

View File

@ -1,10 +1,11 @@
import { unwrapInjected } from "src/utils";
import {
inject,
unref,
computed,
Ref,
watchEffect,
InjectionKey
type Ref,
type InjectionKey
} from "vue-demi";
import { EChartsType } from "../types";
@ -22,7 +23,7 @@ export function useLoading(
): void {
const defaultLoadingOptions = inject(LOADING_OPTIONS_KEY, {});
const realLoadingOptions = computed(() => ({
...unref(defaultLoadingOptions),
...unwrapInjected(defaultLoadingOptions, {}),
...loadingOptions?.value
}));