mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
chore: remove useless code
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
import type { ProjectConfig, GlobConfig, GlobEnvConfig } from '/@/types/config';
|
||||
|
||||
import { getConfigFileName } from '../../../build/getConfigFileName';
|
||||
|
||||
import getProjectSetting from '/@/settings/projectSetting';
|
||||
|
||||
import { getShortName } from '../../../build/getShortName';
|
||||
import { warn } from '/@/utils/log';
|
||||
import { getGlobEnvConfig, isDevMode } from '/@/utils/env';
|
||||
|
||||
const reg = /[a-zA-Z\_]*/;
|
||||
|
||||
const ENV_NAME = getShortName(import.meta.env);
|
||||
const ENV = ((isDevMode()
|
||||
? getGlobEnvConfig()
|
||||
: window[ENV_NAME as any]) as unknown) as GlobEnvConfig;
|
||||
|
||||
const {
|
||||
VITE_GLOB_APP_TITLE,
|
||||
VITE_GLOB_API_URL,
|
||||
VITE_GLOB_APP_SHORT_NAME,
|
||||
VITE_GLOB_API_URL_PREFIX,
|
||||
VITE_GLOB_UPLOAD_URL,
|
||||
} = ENV;
|
||||
|
||||
if (!reg.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||
warn(
|
||||
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`
|
||||
);
|
||||
}
|
||||
|
||||
export const useGlobSetting = (): Readonly<GlobConfig> => {
|
||||
const ENV_NAME = getConfigFileName(import.meta.env);
|
||||
|
||||
const ENV = ((isDevMode()
|
||||
? getGlobEnvConfig()
|
||||
: window[ENV_NAME as any]) as unknown) as GlobEnvConfig;
|
||||
|
||||
const {
|
||||
VITE_GLOB_APP_TITLE,
|
||||
VITE_GLOB_API_URL,
|
||||
VITE_GLOB_APP_SHORT_NAME,
|
||||
VITE_GLOB_API_URL_PREFIX,
|
||||
VITE_GLOB_UPLOAD_URL,
|
||||
} = ENV;
|
||||
|
||||
if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||
warn(
|
||||
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`
|
||||
);
|
||||
}
|
||||
|
||||
// Take global configuration
|
||||
const glob: Readonly<GlobConfig> = {
|
||||
title: VITE_GLOB_APP_TITLE,
|
||||
|
@@ -2,8 +2,6 @@ import { useTimeoutFn } from '/@/hooks/core/useTimeout';
|
||||
import { tryOnUnmounted } from '/@/utils/helper/vueHelper';
|
||||
import { unref, Ref, nextTick } from 'vue';
|
||||
|
||||
import ApexCharts from 'apexcharts';
|
||||
|
||||
interface CallBackFn {
|
||||
(instance: Nullable<ApexCharts>): void;
|
||||
}
|
||||
@@ -13,21 +11,22 @@ export function useApexCharts(elRef: Ref<HTMLDivElement>) {
|
||||
|
||||
function setOptions(options: any, callback?: CallBackFn) {
|
||||
nextTick(() => {
|
||||
useTimeoutFn(() => {
|
||||
useTimeoutFn(async () => {
|
||||
const el = unref(elRef);
|
||||
|
||||
if (!el || !unref(el)) return;
|
||||
const ApexCharts = await (await import('apexcharts')).default;
|
||||
chartInstance = new ApexCharts(el, options);
|
||||
|
||||
chartInstance && chartInstance.render();
|
||||
|
||||
// setOptions增加callback方法,返回chartInstance,以便于对图表进行再操作,例如调用updateOptions方法更新图表
|
||||
// The callback method is added to setOptions to return the chartInstance to facilitate the re-operation of the chart, such as calling the updateOptions method to update the chart
|
||||
callback && callback(chartInstance);
|
||||
}, 30);
|
||||
});
|
||||
}
|
||||
|
||||
// 新增调用ApexCharts的updateOptions方法更新图表
|
||||
// Call the updateOptions method of ApexCharts to update the chart
|
||||
function updateOptions(
|
||||
chartInstance: Nullable<ApexCharts>,
|
||||
options: any,
|
||||
|
@@ -65,9 +65,3 @@ export function useLockPage() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export const getIsLock = computed(() => {
|
||||
const { getLockInfo } = lockStore;
|
||||
const { isLock } = getLockInfo;
|
||||
return isLock;
|
||||
});
|
||||
|
@@ -40,7 +40,7 @@ export function usePermission() {
|
||||
resetRouter();
|
||||
const routes = await permissionStore.buildRoutesAction(id);
|
||||
routes.forEach((route) => {
|
||||
router.addRoute(route as RouteRecordRaw);
|
||||
router.addRoute((route as unknown) as RouteRecordRaw);
|
||||
});
|
||||
permissionStore.commitLastBuildMenuTimeState();
|
||||
const { closeAll } = useTabs();
|
||||
|
@@ -1,11 +1,13 @@
|
||||
import Sortable from 'sortablejs';
|
||||
import { nextTick, unref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import type { Options } from 'sortablejs';
|
||||
|
||||
export function useSortable(el: HTMLElement | Ref<HTMLElement>, options?: Sortable.Options) {
|
||||
export function useSortable(el: HTMLElement | Ref<HTMLElement>, options?: Options) {
|
||||
function initSortable() {
|
||||
nextTick(() => {
|
||||
nextTick(async () => {
|
||||
if (!el) return;
|
||||
|
||||
const Sortable = (await import('sortablejs')).default;
|
||||
Sortable.create(unref(el), {
|
||||
animation: 500,
|
||||
delay: 400,
|
||||
|
Reference in New Issue
Block a user