mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-11-07 05:28:06 +08:00
fix: delay first setOption until initial resize, update deps
This commit is contained in:
@ -3,14 +3,16 @@ import { EChartsType } from "../types";
|
||||
|
||||
export const LOADING_OPTIONS_KEY = "ecLoadingOptions";
|
||||
|
||||
type UnknownRecord = Record<string, unknown>;
|
||||
|
||||
export function useLoading(
|
||||
chart: Ref<EChartsType | undefined>,
|
||||
loading: Ref<boolean>,
|
||||
loadingOptions: Ref<object | undefined>
|
||||
loadingOptions: Ref<UnknownRecord | undefined>
|
||||
): void {
|
||||
const defaultLoadingOptions = inject(LOADING_OPTIONS_KEY, {}) as
|
||||
| object
|
||||
| Ref<object>;
|
||||
| UnknownRecord
|
||||
| Ref<UnknownRecord>;
|
||||
const realLoadingOptions = computed(() => ({
|
||||
...unref(defaultLoadingOptions),
|
||||
...loadingOptions?.value
|
||||
|
||||
Reference in New Issue
Block a user