feat: vue-echarts-next first version

This commit is contained in:
Justineo
2021-02-07 16:16:13 +08:00
parent e4ff8e68e0
commit ee12ad9658
22 changed files with 3029 additions and 855 deletions

View File

@ -0,0 +1,41 @@
import { Ref, PropType, watchEffect } from "vue";
import { EChartsType } from "@/types";
export interface LoadingOptions {
text?: string;
color?: string;
textColor?: string;
maskColor?: string;
zlevel?: number;
fontSize?: number;
showSpinner?: boolean;
spinnerRadius?: number;
lineWidth?: number;
fontWeight?: string | number;
fontStyle?: string;
fontFamily?: string;
}
export function useLoading(
chart: Ref<EChartsType | undefined>,
loading: Ref<boolean>,
loadingOptions?: Ref<LoadingOptions | undefined>
): void {
watchEffect(() => {
const instance = chart.value;
if (!instance) {
return;
}
if (loading.value) {
instance.showLoading(loadingOptions?.value);
} else {
instance.hideLoading();
}
});
}
export const loadingProps = {
loading: Boolean,
loadingOptions: Object as PropType<LoadingOptions>
};