mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-08 07:31:09 +08:00
Merge branch 'main' into main
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
export * from './config';
|
export * from './config';
|
||||||
export * from './options';
|
export * from './options';
|
||||||
export * from './plugins';
|
export * from './plugins';
|
||||||
|
export type * from './typing';
|
||||||
export { loadAndConvertEnv } from './utils/env';
|
export { loadAndConvertEnv } from './utils/env';
|
||||||
|
|||||||
@@ -381,10 +381,10 @@ onUnmounted(() => {
|
|||||||
<div v-if="suffix" class="ml-1">
|
<div v-if="suffix" class="ml-1">
|
||||||
<VbenRenderContent :content="suffix" />
|
<VbenRenderContent :content="suffix" />
|
||||||
</div>
|
</div>
|
||||||
<FormDescription v-if="description" class="ml-1">
|
|
||||||
<VbenRenderContent :content="description" />
|
|
||||||
</FormDescription>
|
|
||||||
</div>
|
</div>
|
||||||
|
<FormDescription v-if="description" class="text-xs">
|
||||||
|
<VbenRenderContent :content="description" />
|
||||||
|
</FormDescription>
|
||||||
|
|
||||||
<Transition name="slide-up" v-if="!compact">
|
<Transition name="slide-up" v-if="!compact">
|
||||||
<FormMessage class="absolute" />
|
<FormMessage class="absolute" />
|
||||||
|
|||||||
@@ -6,7 +6,17 @@ import type { Nullable } from '@vben/types';
|
|||||||
|
|
||||||
import type EchartsUI from './echarts-ui.vue';
|
import type EchartsUI from './echarts-ui.vue';
|
||||||
|
|
||||||
import { computed, nextTick, watch } from 'vue';
|
import {
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
onActivated,
|
||||||
|
onBeforeUnmount,
|
||||||
|
onDeactivated,
|
||||||
|
onMounted,
|
||||||
|
ref,
|
||||||
|
unref,
|
||||||
|
watch,
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
import { usePreferences } from '@vben/preferences';
|
import { usePreferences } from '@vben/preferences';
|
||||||
|
|
||||||
@@ -27,6 +37,8 @@ type EchartsThemeType = 'dark' | 'light' | null;
|
|||||||
function useEcharts(chartRef: Ref<EchartsUIType>) {
|
function useEcharts(chartRef: Ref<EchartsUIType>) {
|
||||||
let chartInstance: echarts.ECharts | null = null;
|
let chartInstance: echarts.ECharts | null = null;
|
||||||
let cacheOptions: EChartsOption = {};
|
let cacheOptions: EChartsOption = {};
|
||||||
|
// echart是否处于激活状态
|
||||||
|
const isActiveRef = ref(false);
|
||||||
|
|
||||||
const { isDark } = usePreferences();
|
const { isDark } = usePreferences();
|
||||||
const { height, width } = useWindowSize();
|
const { height, width } = useWindowSize();
|
||||||
@@ -42,6 +54,11 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
|
|||||||
return maybeComponent.$el ?? null;
|
return maybeComponent.$el ?? null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(() => (isActiveRef.value = true));
|
||||||
|
onActivated(() => (isActiveRef.value = true));
|
||||||
|
onDeactivated(() => (isActiveRef.value = false));
|
||||||
|
onBeforeUnmount(() => (isActiveRef.value = false));
|
||||||
|
|
||||||
const isElHidden = (el: HTMLElement | null): boolean => {
|
const isElHidden = (el: HTMLElement | null): boolean => {
|
||||||
if (!el) return true;
|
if (!el) return true;
|
||||||
return el.offsetHeight === 0 || el.offsetWidth === 0;
|
return el.offsetHeight === 0 || el.offsetWidth === 0;
|
||||||
@@ -71,6 +88,9 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
|
|||||||
options: EChartsOption,
|
options: EChartsOption,
|
||||||
clear = true,
|
clear = true,
|
||||||
): Promise<Nullable<echarts.ECharts>> => {
|
): Promise<Nullable<echarts.ECharts>> => {
|
||||||
|
if (!unref(isActiveRef)) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
cacheOptions = options;
|
cacheOptions = options;
|
||||||
const currentOptions = {
|
const currentOptions = {
|
||||||
...options,
|
...options,
|
||||||
@@ -154,8 +174,8 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
|
|||||||
|
|
||||||
useResizeObserver(chartRef as never, resizeHandler);
|
useResizeObserver(chartRef as never, resizeHandler);
|
||||||
|
|
||||||
watch(isDark, () => {
|
watch([isDark, isActiveRef], () => {
|
||||||
if (chartInstance) {
|
if (chartInstance && unref(isActiveRef)) {
|
||||||
chartInstance.dispose();
|
chartInstance.dispose();
|
||||||
initCharts();
|
initCharts();
|
||||||
renderEcharts(cacheOptions);
|
renderEcharts(cacheOptions);
|
||||||
@@ -168,6 +188,7 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
|
|||||||
chartInstance?.dispose();
|
chartInstance?.dispose();
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
isActive: isActiveRef,
|
||||||
renderEcharts,
|
renderEcharts,
|
||||||
resize,
|
resize,
|
||||||
updateData,
|
updateData,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
affixTab: true,
|
affixTab: true,
|
||||||
icon: 'lucide:area-chart',
|
icon: 'lucide:area-chart',
|
||||||
title: $t('page.dashboard.analytics'),
|
title: $t('page.dashboard.analytics'),
|
||||||
|
keepAlive: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ const [BaseForm, baseFormApi] = useVbenForm({
|
|||||||
label: '字符串',
|
label: '字符串',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'desc',
|
||||||
|
// 界面显示的description
|
||||||
|
description: '这是表单描述',
|
||||||
|
label: '字符串(带描述)',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// 组件需要在 #/adapter.ts内注册,并加上类型
|
// 组件需要在 #/adapter.ts内注册,并加上类型
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
|
|||||||
Reference in New Issue
Block a user