fix: 报错和打包问题
This commit is contained in:
parent
2b11631b39
commit
b1e6814b31
12
build/css.ts
12
build/css.ts
|
@ -1,26 +1,26 @@
|
||||||
|
import type { AcceptedPlugin } from 'postcss';
|
||||||
import postCssPxToViewport8plugin from 'postcss-px-to-viewport-8-plugin';
|
import postCssPxToViewport8plugin from 'postcss-px-to-viewport-8-plugin';
|
||||||
import type { CSSOptions, Plugin } from 'vite';
|
import type { CSSOptions } from 'vite';
|
||||||
|
|
||||||
import { wrapperEnv } from './utils';
|
import { wrapperEnv } from './utils';
|
||||||
|
|
||||||
export const css = (mode): CSSOptions => {
|
export const css = (mode: string): CSSOptions => {
|
||||||
const plugins: Plugin[] = [usePostCssPxToViewport8plugin(mode)];
|
const plugins: AcceptedPlugin[] = [usePostCssPxToViewport8plugin(mode)];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
scss: {
|
scss: {
|
||||||
additionalData: `@use "@/assets/styles/minix/sidebar" as *;`,
|
additionalData: `@use "@/assets/styles/minix/sidebar" as *;`,
|
||||||
api: 'modern-compiler',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: plugins.filter(Boolean),
|
plugins: plugins.filter(Boolean),
|
||||||
},
|
},
|
||||||
} as CSSOptions;
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 是否启用px转换vw插件 */
|
/** 是否启用px转换vw插件 */
|
||||||
const usePostCssPxToViewport8plugin = (mode): Plugin => {
|
const usePostCssPxToViewport8plugin = (mode: string): AcceptedPlugin => {
|
||||||
const { VITE_POST_CSS_PX_TO_VIEWPORT8_PLUGIN } = wrapperEnv(mode, 'VITE');
|
const { VITE_POST_CSS_PX_TO_VIEWPORT8_PLUGIN } = wrapperEnv(mode, 'VITE');
|
||||||
|
|
||||||
const cssPxToVw = postCssPxToViewport8plugin({
|
const cssPxToVw = postCssPxToViewport8plugin({
|
||||||
|
|
|
@ -17,8 +17,7 @@ const boxenOptions: BoxenOptions = {
|
||||||
/* 输出日志信息 */
|
/* 输出日志信息 */
|
||||||
const printLogMessage = (VITE_PORT: number) => {
|
const printLogMessage = (VITE_PORT: number) => {
|
||||||
return gradientString('cyan', 'magenta').multiline(
|
return gradientString('cyan', 'magenta').multiline(
|
||||||
`保存成功!服务器重新启动...
|
`欢迎使用此项目,项目访问地址如下:
|
||||||
项目访问地址如下:
|
|
||||||
http://localhost:${VITE_PORT}`
|
http://localhost:${VITE_PORT}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,6 @@ const include = ['vue', 'vue-router', 'dayjs', 'axios', 'pinia', 'vue-types', 'j
|
||||||
/**
|
/**
|
||||||
* 在预构建中强制排除的依赖项
|
* 在预构建中强制排除的依赖项
|
||||||
*/
|
*/
|
||||||
const exclude = [];
|
const exclude: string[] = [];
|
||||||
|
|
||||||
export { include, exclude };
|
export { include, exclude };
|
||||||
|
|
|
@ -6,13 +6,14 @@ import UnoCSS from 'unocss/vite';
|
||||||
import type { PluginOption } from 'vite';
|
import type { PluginOption } from 'vite';
|
||||||
import { vitePluginFakeServer } from 'vite-plugin-fake-server';
|
import { vitePluginFakeServer } from 'vite-plugin-fake-server';
|
||||||
import removeConsole from 'vite-plugin-remove-console';
|
import removeConsole from 'vite-plugin-remove-console';
|
||||||
|
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
||||||
import Inspector from 'vite-plugin-vue-inspector';
|
import Inspector from 'vite-plugin-vue-inspector';
|
||||||
|
|
||||||
import { useCDN } from './cdn';
|
import { useCDN } from './cdn';
|
||||||
import { viteConsoleLog } from './info';
|
import { viteConsoleLog } from './info';
|
||||||
import { compressPack, report, wrapperEnv } from './utils';
|
import { compressPack, report, wrapperEnv } from './utils';
|
||||||
|
|
||||||
export const plugins = (mode): PluginOption[] => {
|
export const plugins = (mode: string): PluginOption[] => {
|
||||||
return [
|
return [
|
||||||
vue(),
|
vue(),
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
|
@ -41,13 +42,21 @@ export const plugins = (mode): PluginOption[] => {
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
createStyleImportPlugin({
|
||||||
|
libs: [
|
||||||
|
{
|
||||||
|
libraryName: 'vite-plugin-style-import',
|
||||||
|
resolveStyle: (name) => `@/assets/${name}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
compressPack(mode),
|
compressPack(mode),
|
||||||
useMock(mode),
|
useMock(mode),
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** MOCK 服务 */
|
/** MOCK 服务 */
|
||||||
const useMock = (mode) => {
|
const useMock = (mode: string) => {
|
||||||
const { VITE_MOCK_DEV_SERVER } = wrapperEnv(mode);
|
const { VITE_MOCK_DEV_SERVER } = wrapperEnv(mode);
|
||||||
|
|
||||||
return VITE_MOCK_DEV_SERVER
|
return VITE_MOCK_DEV_SERVER
|
||||||
|
|
|
@ -4,7 +4,7 @@ export const resolve = () => {
|
||||||
return {
|
return {
|
||||||
alias: {
|
alias: {
|
||||||
'@': pathResolve('../src'),
|
'@': pathResolve('../src'),
|
||||||
'@build': pathResolve(),
|
// '@build': pathResolve(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { ServerOptions } from 'vite';
|
||||||
import { wrapperEnv } from './utils';
|
import { wrapperEnv } from './utils';
|
||||||
|
|
||||||
/* 开发服务配置 */
|
/* 开发服务配置 */
|
||||||
export const server = (mode) => {
|
export const server = (mode: string) => {
|
||||||
const { VITE_PORT, VITE_APP_URL, VITE_STRICT_PORT } = wrapperEnv(mode);
|
const { VITE_PORT, VITE_APP_URL, VITE_STRICT_PORT } = wrapperEnv(mode);
|
||||||
|
|
||||||
const options: ServerOptions = {
|
const options: ServerOptions = {
|
||||||
|
|
|
@ -34,18 +34,20 @@ export const pathResolve = (dir = '.', metaUrl = import.meta.url) => {
|
||||||
* @param prefix 需要过滤的前缀
|
* @param prefix 需要过滤的前缀
|
||||||
* @link 参考:https://cn.vite.dev/config/#using-environment-variables-in-config
|
* @link 参考:https://cn.vite.dev/config/#using-environment-variables-in-config
|
||||||
*/
|
*/
|
||||||
export const wrapperEnv = (mode, prefix: string = ''): ViteEnv => {
|
// @ts-ignore
|
||||||
const env = loadEnv(mode, root, prefix);
|
export const wrapperEnv = (mode: string, prefix: string = ''): ViteEnv => {
|
||||||
|
const env: any = loadEnv(mode, root, prefix);
|
||||||
|
|
||||||
// 将变量转换指定类型
|
// 将变量转换指定类型
|
||||||
for (const envName of Object.keys(env)) {
|
for (const envName of Object.keys(env)) {
|
||||||
let realName = env[envName].replace(/\\n/g, '\n');
|
let realName: string | boolean | number = env[envName].replace(/\\n/g, '\n');
|
||||||
realName = realName === 'true' ? true : realName === 'false' ? false : realName;
|
realName = realName === 'true' ? true : realName === 'false' ? false : realName;
|
||||||
|
|
||||||
if (envName === 'VITE_PORT') {
|
if (envName === 'VITE_PORT') {
|
||||||
realName = Number(realName);
|
realName = Number(realName);
|
||||||
}
|
}
|
||||||
env[envName] = realName;
|
env[envName] = realName;
|
||||||
|
// @ts-ignore
|
||||||
process.env[envName] = realName;
|
process.env[envName] = realName;
|
||||||
}
|
}
|
||||||
return env;
|
return env;
|
||||||
|
@ -60,7 +62,7 @@ export const report = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 启用gzip压缩 */
|
/* 启用gzip压缩 */
|
||||||
export const compressPack = (mode) => {
|
export const compressPack = (mode: string) => {
|
||||||
const { VITE_COMPRESSION } = wrapperEnv(mode);
|
const { VITE_COMPRESSION } = wrapperEnv(mode);
|
||||||
|
|
||||||
return VITE_COMPRESSION == 'gzip' ? viteCompression({ threshold: 1024000 }) : null;
|
return VITE_COMPRESSION == 'gzip' ? viteCompression({ threshold: 1024000 }) : null;
|
||||||
|
|
|
@ -83,7 +83,7 @@ export default defineFlatConfig([
|
||||||
rules: {
|
rules: {
|
||||||
...pluginTypeScript.configs.strict.rules,
|
...pluginTypeScript.configs.strict.rules,
|
||||||
'@typescript-eslint/ban-types': 'off',
|
'@typescript-eslint/ban-types': 'off',
|
||||||
'@typescript-eslint/no-redeclare': 'error',
|
'@typescript-eslint/no-redeclare': 'off',
|
||||||
'@typescript-eslint/ban-ts-comment': 'off',
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
'@typescript-eslint/prefer-as-const': 'warn',
|
'@typescript-eslint/prefer-as-const': 'warn',
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { defineFakeRoute } from 'vite-plugin-fake-server/client';
|
||||||
export default defineFakeRoute([
|
export default defineFakeRoute([
|
||||||
{
|
{
|
||||||
url: '/mock/users',
|
url: '/mock/users',
|
||||||
methods: 'get',
|
method: 'GET',
|
||||||
response: () => ({
|
response: () => ({
|
||||||
code: 200,
|
code: 200,
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.21.0",
|
||||||
|
"@parcel/watcher": "^2.5.1",
|
||||||
|
"@types/node": "^22.13.10",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
||||||
"@typescript-eslint/parser": "^8.24.1",
|
"@typescript-eslint/parser": "^8.24.1",
|
||||||
"@unocss/preset-icons": "^66.0.0",
|
"@unocss/preset-icons": "^66.0.0",
|
||||||
|
@ -25,6 +27,7 @@
|
||||||
"boxen": "^8.0.1",
|
"boxen": "^8.0.1",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"echarts": "^5.6.0",
|
"echarts": "^5.6.0",
|
||||||
|
"esbuild": "^0.25.1",
|
||||||
"eslint": "^9.9.1",
|
"eslint": "^9.9.1",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-define-config": "^2.1.0",
|
"eslint-define-config": "^2.1.0",
|
||||||
|
@ -36,6 +39,7 @@
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "^2.3.1",
|
"pinia": "^2.3.1",
|
||||||
"pinia-plugin-persistedstate": "^3.2.3",
|
"pinia-plugin-persistedstate": "^3.2.3",
|
||||||
|
"postcss": "^8.5.3",
|
||||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"qs": "^6.14.0",
|
"qs": "^6.14.0",
|
||||||
|
@ -54,18 +58,22 @@
|
||||||
"vite-plugin-remove-console": "^2.2.0",
|
"vite-plugin-remove-console": "^2.2.0",
|
||||||
"vite-plugin-vue-inspector": "^5.3.1",
|
"vite-plugin-vue-inspector": "^5.3.1",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
|
"vue-demi": "^0.14.10",
|
||||||
"vue-eslint-parser": "^9.4.3",
|
"vue-eslint-parser": "^9.4.3",
|
||||||
"vue-router": "^4.4.3",
|
"vue-router": "^4.4.3",
|
||||||
"vue-types": "^6.0.0"
|
"vue-types": "^6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify/json": "^2.2.310",
|
"@iconify/json": "^2.2.310",
|
||||||
|
"@types/nprogress": "^0.2.3",
|
||||||
|
"@types/qs": "^6.9.18",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"@vue/tsconfig": "^0.7.0",
|
"@vue/tsconfig": "^0.7.0",
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"typescript": "~5.7.2",
|
"typescript": "~5.7.2",
|
||||||
"vite": "^6.1.0",
|
"vite": "^6.1.0",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
|
"vite-plugin-style-import": "^2.0.0",
|
||||||
"vue-tsc": "^2.2.0"
|
"vue-tsc": "^2.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
540
pnpm-lock.yaml
540
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -6,10 +6,10 @@
|
||||||
</router-view>
|
</router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style lang="scss">
|
||||||
#app {
|
#app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
//height: 100%;
|
|
||||||
height: 1080px;
|
height: 1080px;
|
||||||
|
//height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -44,7 +44,7 @@ service.interceptors.response.use(
|
||||||
}
|
}
|
||||||
|
|
||||||
// ElMessage.error(msg || '系统出错');
|
// ElMessage.error(msg || '系统出错');
|
||||||
return Promise.reject(msg || 'Error');
|
return Promise.reject(response.data.message || 'Error');
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
// 异常处理
|
// 异常处理
|
||||||
|
|
|
@ -44,7 +44,7 @@ service.interceptors.response.use(
|
||||||
}
|
}
|
||||||
|
|
||||||
// ElMessage.error(msg || '系统出错');
|
// ElMessage.error(msg || '系统出错');
|
||||||
return Promise.reject(msg || 'Error');
|
return Promise.reject(response.data.message || 'Error');
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
// 异常处理
|
// 异常处理
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'animate.css';
|
||||||
import '@unocss/reset/tailwind-compat.css';
|
import '@unocss/reset/tailwind-compat.css';
|
||||||
import 'uno.css';
|
import 'uno.css';
|
||||||
import 'virtual:unocss-devtools';
|
import 'virtual:unocss-devtools';
|
||||||
import '@/assets/styles/global.scss';
|
import './assets/styles/global.scss';
|
||||||
|
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import error from '@/router/modules/error';
|
||||||
import remaining from '@/router/modules/remaining';
|
import remaining from '@/router/modules/remaining';
|
||||||
|
|
||||||
// 静态路由
|
// 静态路由
|
||||||
const routes: RouteRecordRaw[] = [...remaining, ...error];
|
const routes: RouteRecordRaw[] = [...remaining, ...error] as RouteRecordRaw[];
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes,
|
routes,
|
||||||
|
|
|
@ -2,8 +2,9 @@ import type { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
import Layout from '@/layout/index.vue';
|
import Layout from '@/layout/index.vue';
|
||||||
import home from '@/router/modules/home';
|
import home from '@/router/modules/home';
|
||||||
|
import type { RouteConfigsTable } from '@/types/router/Route';
|
||||||
|
|
||||||
const routes: RouteRecordRaw[] = [
|
const routes: RouteRecordRaw[] | RouteConfigsTable[] = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'layout',
|
name: 'layout',
|
||||||
|
|
|
@ -10,7 +10,7 @@ const useAppStore = defineStore('appStore', {
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
setBackground(background) {
|
setBackground(background: string) {
|
||||||
if (isCSSColor(background)) {
|
if (isCSSColor(background)) {
|
||||||
this.background = background;
|
this.background = background;
|
||||||
} else if (isPath(background)) {
|
} else if (isPath(background)) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { defineStore } from 'pinia';
|
||||||
import { user } from '@/api/test';
|
import { user } from '@/api/test';
|
||||||
|
|
||||||
/** 用户信息 */
|
/** 用户信息 */
|
||||||
const useUserStore = defineStore('userStore', {
|
export const useUserStore = defineStore('userStore', {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
userinfo: {},
|
userinfo: {},
|
||||||
|
@ -19,5 +19,3 @@ const useUserStore = defineStore('userStore', {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export { useUserStore };
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
declare global {
|
declare global {
|
||||||
/* 环境便配置 */
|
/* 环境便配置 */
|
||||||
declare interface ViteEnv {
|
export declare interface ViteEnv {
|
||||||
VITE_APP_TITLE: string;
|
VITE_APP_TITLE: string;
|
||||||
VITE_PORT: number;
|
VITE_PORT: number;
|
||||||
VITE_PUBLIC_PATH: string;
|
VITE_PUBLIC_PATH: string;
|
||||||
|
|
|
@ -4,15 +4,16 @@ import type { RouteComponent } from 'vue-router';
|
||||||
* @description 完整子路由的`meta`配置表
|
* @description 完整子路由的`meta`配置表
|
||||||
*/
|
*/
|
||||||
interface CustomizeRouteMeta {
|
interface CustomizeRouteMeta {
|
||||||
title: string;
|
title?: string;
|
||||||
subtitle: string;
|
subtitle?: string;
|
||||||
transition: string;
|
transition?: string;
|
||||||
|
hidden?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 整体路由配置表(包括完整子路由)
|
* @description 整体路由配置表(包括完整子路由)
|
||||||
*/
|
*/
|
||||||
interface RouteConfigsTable {
|
export interface RouteConfigsTable {
|
||||||
/** 路由地址 `必填` */
|
/** 路由地址 `必填` */
|
||||||
path: string;
|
path: string;
|
||||||
/** 路由名字(保持唯一)`可选` */
|
/** 路由名字(保持唯一)`可选` */
|
||||||
|
@ -25,5 +26,3 @@ interface RouteConfigsTable {
|
||||||
/** 子路由配置项 */
|
/** 子路由配置项 */
|
||||||
children?: Array<RouteConfigsTable>;
|
children?: Array<RouteConfigsTable>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { RouteConfigsTable };
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import { useEventListener } from '@vueuse/core';
|
import { useDebounceFn, useEventListener } from '@vueuse/core';
|
||||||
import type { EChartsType } from 'echarts';
|
import type { EChartsType } from 'echarts';
|
||||||
|
|
||||||
/** 通用重置图表样式 */
|
/** 通用重置图表样式 */
|
||||||
export const debounceChart = (myChart: EChartsType | undefined) => {
|
export const debounceChart = (myChart: EChartsType | undefined) => {
|
||||||
useEventListener(window, 'resize', () => {
|
const debounceFn = useDebounceFn(() => {
|
||||||
myChart!.resize();
|
myChart!.resize();
|
||||||
});
|
}, 500);
|
||||||
|
|
||||||
|
useEventListener(window, 'resize', debounceFn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 数字格式化 */
|
/** 数字格式化 */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/** 判断是否是CSS颜色 */
|
/** 判断是否是CSS颜色 */
|
||||||
function isCSSColor(str) {
|
function isCSSColor(str: string) {
|
||||||
// 匹配十六进制颜色(如 #fff, #ffffff)
|
// 匹配十六进制颜色(如 #fff, #ffffff)
|
||||||
const hexColor = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
const hexColor = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ function isCSSColor(str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 判断是否是相对路径或绝对路径 */
|
/** 判断是否是相对路径或绝对路径 */
|
||||||
function isPath(str) {
|
function isPath(str: string) {
|
||||||
// 匹配相对路径(如 ./path, ../path, path/to/file)
|
// 匹配相对路径(如 ./path, ../path, path/to/file)
|
||||||
const relativePath = /^\.{0,2}\/[^\/].*$/;
|
const relativePath = /^\.{0,2}\/[^\/].*$/;
|
||||||
|
|
||||||
|
|
|
@ -98,10 +98,11 @@ export const ChartProgress = defineComponent({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => <div ref={chart} class="progress"></div>;
|
return () => <div ref={chart} className="progress"></div>;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 更新图标数据 */
|
||||||
const updateChart = (myChart: Ref<EChartsType | undefined>, props: any) => {
|
const updateChart = (myChart: Ref<EChartsType | undefined>, props: any) => {
|
||||||
myChart.value?.setOption({
|
myChart.value?.setOption({
|
||||||
series: [
|
series: [
|
||||||
|
|
|
@ -45,7 +45,7 @@ option.value = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const renderEcharts = (element: Ref<HTMLDivElement>) => {
|
export const renderEcharts = (element: Ref<HTMLDivElement>) => {
|
||||||
const myChart = echarts.init(element.value, null, {
|
const myChart: any = echarts.init(element.value, null, {
|
||||||
renderer: 'svg',
|
renderer: 'svg',
|
||||||
devicePixelRatio: window.devicePixelRatio,
|
devicePixelRatio: window.devicePixelRatio,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import 'echarts/lib/component/dataZoom';
|
import 'echarts/lib/component/dataZoom';
|
||||||
|
|
||||||
import type { EChartsOption } from 'echarts';
|
|
||||||
import { type Ref, ref } from 'vue';
|
import { type Ref, ref } from 'vue';
|
||||||
|
|
||||||
import echarts from '@/plugins/echarts';
|
import echarts from '@/plugins/echarts';
|
||||||
import { debounceChart } from '@/utils/chart';
|
import { debounceChart } from '@/utils/chart';
|
||||||
|
|
||||||
const option = ref<EChartsOption>();
|
const option = ref<any>();
|
||||||
option.value = {
|
option.value = {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
grid: { right: 10, left: 10, bottom: 20 },
|
grid: { right: 10, left: 10, bottom: 20 },
|
||||||
|
@ -97,7 +96,7 @@ option.value = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const renderEcharts = (element: Ref<HTMLDivElement>) => {
|
export const renderEcharts = (element: Ref<HTMLDivElement>) => {
|
||||||
const myChart = echarts.init(element.value, null, {
|
const myChart: any = echarts.init(element.value, null, {
|
||||||
renderer: 'svg',
|
renderer: 'svg',
|
||||||
devicePixelRatio: window.devicePixelRatio,
|
devicePixelRatio: window.devicePixelRatio,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,50 +1,49 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "ESNext",
|
||||||
"useDefineForClassFields": true,
|
"module": "ESNext",
|
||||||
"module": "esnext",
|
"moduleResolution": "bundler",
|
||||||
"moduleResolution": "node",
|
"strict": false,
|
||||||
"strict": true,
|
"jsx": "preserve",
|
||||||
"noLib": false,
|
"importHelpers": true,
|
||||||
"sourceMap": true,
|
"experimentalDecorators": true,
|
||||||
"resolveJsonModule": true,
|
"strictFunctionTypes": false,
|
||||||
"esModuleInterop": true,
|
|
||||||
"lib": [
|
|
||||||
"esnext",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
"baseUrl": ".",
|
|
||||||
"allowJs": true,
|
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"jsx": "preserve",
|
"sourceMap": true,
|
||||||
"jsxFactory": "h",
|
"baseUrl": ".",
|
||||||
"jsxImportSource": "vue",
|
"allowJs": false,
|
||||||
"jsxFragmentFactory": "Fragment",
|
"resolveJsonModule": true,
|
||||||
|
"lib": [
|
||||||
|
"ESNext",
|
||||||
|
"DOM"
|
||||||
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
"src/*"
|
"src/*"
|
||||||
]
|
]
|
||||||
|
// "@build/*": [
|
||||||
|
// "build/*"
|
||||||
|
// ]
|
||||||
},
|
},
|
||||||
"types": [
|
"types": [
|
||||||
"vite/client",
|
"node",
|
||||||
"unplugin-icons/types/vue",
|
"vite/client"
|
||||||
"element-plus/global"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"files": [],
|
|
||||||
"include": [
|
"include": [
|
||||||
"mock/*.ts",
|
"mock/*.ts",
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"src/types/*.d.ts",
|
"vite.config.ts",
|
||||||
"vite.config.ts"
|
"src/**/*.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist",
|
"dist",
|
||||||
"**/*.js",
|
|
||||||
"node_modules"
|
"node_modules"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import { server } from './build/server';
|
||||||
import { root, wrapperEnv } from './build/utils';
|
import { root, wrapperEnv } from './build/utils';
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
|
// export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
|
||||||
|
export default defineConfig(({ mode }) => {
|
||||||
const env = wrapperEnv(mode, 'VITE');
|
const env = wrapperEnv(mode, 'VITE');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue