diff --git a/src/components/Container/index.ts b/src/components/Container/index.ts index e1131178bdd7bd819aa1bdac6d8361fe854cfd6d..eb708d497318e355ba2e5f70016d08a4bf112ca4 100644 --- a/src/components/Container/index.ts +++ b/src/components/Container/index.ts @@ -1,12 +1,14 @@ import { withInstall } from '../util'; - +import CollapseContainer from './src/collapse/CollapseContainer.vue'; import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; export const ScrollContainer = createAsyncComponent(() => import('./src/ScrollContainer.vue')); -export const CollapseContainer = createAsyncComponent( - () => import('./src/collapse/CollapseContainer.vue') -); + +// export const CollapseContainer = createAsyncComponent( +// () => import('./src/collapse/CollapseContainer.vue') +// ); export const LazyContainer = createAsyncComponent(() => import('./src/LazyContainer.vue')); withInstall(ScrollContainer, CollapseContainer, LazyContainer); +export { CollapseContainer }; export * from './src/types'; diff --git a/src/hooks/web/useApexCharts.ts b/src/hooks/web/useApexCharts.ts index 717ed551329b88c7f0e3f9f48381ec9ea6cf97cf..34fb20e73b59f4479e6a6269fe71abf974a5340f 100644 --- a/src/hooks/web/useApexCharts.ts +++ b/src/hooks/web/useApexCharts.ts @@ -4,10 +4,14 @@ import { unref, Ref, nextTick } from 'vue'; import ApexCharts from 'apexcharts'; +interface CallBackFn { + (instance: Nullable): void; +} + export function useApexCharts(elRef: Ref) { let chartInstance: Nullable = null; - function setOptions(options: any, callback) { + function setOptions(options: any, callback?: CallBackFn) { nextTick(() => { useTimeoutFn(() => { const el = unref(elRef); @@ -16,37 +20,29 @@ export function useApexCharts(elRef: Ref) { chartInstance = new ApexCharts(el, options); chartInstance && chartInstance.render(); - + // setOptions增加callback方法,返回chartInstance,以便于对图表进行再操作,例如调用updateOptions方法更新图表 callback && callback(chartInstance); - }, 30); }); } - + // 新增调用ApexCharts的updateOptions方法更新图表 function updateOptions( - chartInstance: Nullable, - options, - redraw = false, - animate = true, - updateSyncedCharts = true, - overwriteInitialConfig = true, - callback) { + chartInstance: Nullable, + options: any, + redraw = false, + animate = true, + updateSyncedCharts = true, + callback: CallBackFn + ) { nextTick(() => { useTimeoutFn(() => { + chartInstance && chartInstance.updateOptions(options, redraw, animate, updateSyncedCharts); - chartInstance && chartInstance.updateOptions( - options, - redraw, - animate, - updateSyncedCharts, - overwriteInitialConfig); - callback && callback(chartInstance); - }, 30); - }); + }); } tryOnUnmounted(() => { diff --git a/src/hooks/web/useECharts.ts b/src/hooks/web/useECharts.ts index 5ad47b80a1d183930634e842df976ab86b259d0c..a069ddc00e7822ad5bca899e26cb025d662d33a6 100644 --- a/src/hooks/web/useECharts.ts +++ b/src/hooks/web/useECharts.ts @@ -21,10 +21,10 @@ export function useECharts( function init() { const el = unref(elRef); - if (!el || !unref(el)) { return; } + chartInstance = echarts.init(el, theme); const { removeEvent } = useEventListener({ el: window, @@ -33,7 +33,7 @@ export function useECharts( }); removeResizeFn = removeEvent; const { widthRef, screenEnum } = useBreakpoint(); - if (unref(widthRef) <= screenEnum.MD) { + if (unref(widthRef) <= screenEnum.MD || el.offsetHeight === 0) { useTimeoutFn(() => { resizeFn(); }, 30); @@ -41,6 +41,12 @@ export function useECharts( } function setOptions(options: any, clear = true) { + if (unref(elRef)?.offsetHeight === 0) { + useTimeoutFn(() => { + setOptions(options); + }, 30); + return; + } nextTick(() => { useTimeoutFn(() => { if (!chartInstance) { @@ -48,16 +54,15 @@ export function useECharts( if (!chartInstance) return; } - clear && chartInstance.clear(); + clear && chartInstance?.clear(); - chartInstance && chartInstance.setOption(options); + chartInstance?.setOption(options); }, 30); }); } function resize() { - if (!chartInstance) return; - chartInstance.resize(); + chartInstance?.resize(); } tryOnUnmounted(() => { diff --git a/src/layouts/default/sider/MixSider.vue b/src/layouts/default/sider/MixSider.vue index 273e5726ddba45707ab79269e30da47ed343c76f..daa5691fdf4d9cb68eee32bd92d3476ba140d286 100644 --- a/src/layouts/default/sider/MixSider.vue +++ b/src/layouts/default/sider/MixSider.vue @@ -110,7 +110,6 @@ getCanDrag, getCloseMixSidebarOnChange, getMenuTheme, - getMixSidebarTheme, } = useMenuSetting(); const { title } = useGlobSetting(); @@ -193,7 +192,6 @@ title, openMenu, getMenuTheme, - getMixSidebarTheme, }; }, }); @@ -290,9 +288,12 @@ } } + > .scrollbar { + height: calc(100% - @header-height) !important; + } + &-module { position: relative; - height: calc(100% - @header-height) !important; padding-top: 1px; &__item { diff --git a/src/views/dashboard/analysis/components/AnalysisPie.vue b/src/views/dashboard/analysis/components/AnalysisPie.vue index f550784415d463277fb1f7421e67d71373312b9a..d1aacec790c92aecd61f314d8da790e856649895 100644 --- a/src/views/dashboard/analysis/components/AnalysisPie.vue +++ b/src/views/dashboard/analysis/components/AnalysisPie.vue @@ -15,7 +15,6 @@ { value: 234, name: '其他', itemStyle: { color: '#7dd9b9' } }, ]; export default defineComponent({ - name: 'AnalysisLine', props: basicProps, setup() { const chartRef = ref(null); diff --git a/src/views/dashboard/analysis/components/TrendLine.vue b/src/views/dashboard/analysis/components/TrendLine.vue index 519d036b0db24c1ec26c94f196f767815698e8e5..5c952671d5d7cb668b7714aa00184ca90bd12802 100644 --- a/src/views/dashboard/analysis/components/TrendLine.vue +++ b/src/views/dashboard/analysis/components/TrendLine.vue @@ -8,7 +8,6 @@ import { basicProps } from './props'; export default defineComponent({ - name: 'AnalysisLine', props: basicProps, setup() { const chartRef = ref(null);