!69 修复升级依赖带来的类型问题

* fix 修复变量问题
* Merge remote-tracking branch 'origin/dev' into dev
* update 依赖升级
* update 依赖升级
* Merge remote-tracking branch 'origin/dev' into dev
* 升级依赖
* Merge remote-tracking branch 'origin/ts' into ts
* 升级依赖
* Merge branch 'dev' of gitee.com:JavaLionLi/plus-ui into ts
* 升级依赖
* !61 fix: 删除重复环境变量ElUploadInstance
* fix: 删除重复环境变量ElUploadInstance
This commit is contained in:
ahaos 2023-12-14 08:17:12 +00:00
parent 031d83828a
commit 1d5133b695
37 changed files with 124 additions and 125 deletions

View File

@ -22,6 +22,8 @@ module.exports = {
rules: { rules: {
'@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-this-alias': 'off',
// vue // vue
'vue/multi-word-component-names': 'off', 'vue/multi-word-component-names': 'off',

1
.gitignore vendored
View File

@ -22,6 +22,7 @@ selenium-debug.log
package-lock.json package-lock.json
yarn.lock yarn.lock
pnpm-lock.yaml
# 编译生成的文件 # 编译生成的文件
auto-imports.d.ts auto-imports.d.ts

View File

@ -33,9 +33,9 @@ const isDashboard = (route: RouteLocationMatched) => {
} }
return name.trim() === 'Index'; return name.trim() === 'Index';
}; };
const handleLink = (item: RouteLocationMatched) => { const handleLink = (item) => {
const { redirect, path } = item; const { redirect, path } = item;
redirect ? router.push(redirect as string) : router.push(path); redirect ? router.push(redirect) : router.push(path);
}; };
watchEffect(() => { watchEffect(() => {

View File

@ -27,11 +27,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { QuillEditor, Quill } from '@vueup/vue-quill';
import '@vueup/vue-quill/dist/vue-quill.snow.css'; import '@vueup/vue-quill/dist/vue-quill.snow.css';
import { QuillEditor, Quill } from '@vueup/vue-quill';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request'; import { globalHeaders } from '@/utils/request';
defineEmits(['update:modelValue']);
const props = defineProps({ const props = defineProps({
/* 编辑器的内容 */ /* 编辑器的内容 */
modelValue: propTypes.string, modelValue: propTypes.string,
@ -55,7 +58,7 @@ const upload = reactive<UploadOption>({
}); });
const quillEditorRef = ref(); const quillEditorRef = ref();
const options = ref({ const options = ref<any>({
theme: 'snow', theme: 'snow',
bounds: document.body, bounds: document.body,
debug: 'warn', debug: 'warn',

View File

@ -48,7 +48,10 @@ import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request'; import { globalHeaders } from '@/utils/request';
const props = defineProps({ const props = defineProps({
modelValue: [String, Object, Array], modelValue: {
type: [String, Object, Array],
default: () => []
},
// //
limit: propTypes.number.def(5), limit: propTypes.number.def(5),
// (MB) // (MB)
@ -79,11 +82,11 @@ watch(
if (val) { if (val) {
let temp = 1; let temp = 1;
// //
let list = []; let list: any[] = [];
if (Array.isArray(val)) { if (Array.isArray(val)) {
list = val; list = val;
} else { } else {
const res = await listByIds(val as string); const res = await listByIds(val);
list = res.data.map((oss) => { list = res.data.map((oss) => {
const data = { const data = {
name: oss.originalName, name: oss.originalName,

View File

@ -33,7 +33,7 @@ const realSrc = computed(() => {
const realSrcList = computed(() => { const realSrcList = computed(() => {
if (!props.src) { if (!props.src) {
return; return [];
} }
let real_src_list = props.src.split(','); let real_src_list = props.src.split(',');
let srcList: string[] = []; let srcList: string[] = [];

View File

@ -46,7 +46,10 @@ import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request'; import { globalHeaders } from '@/utils/request';
const props = defineProps({ const props = defineProps({
modelValue: [String, Object, Array], modelValue: {
type: [String, Object, Array],
default: () => []
},
// //
limit: propTypes.number.def(5), limit: propTypes.number.def(5),
// (MB) // (MB)

View File

@ -1,6 +1,6 @@
<template> <template>
<div :style="'height:' + height"> <div :style="'height:' + height">
<iframe :id="iframeId" style="width: 100%; height: 100%" :src="src" frameborder="no"></iframe> <iframe :id="iframeId" style="width: 100%; height: 100%; border: 0" :src="src"></iframe>
</div> </div>
</template> </template>

View File

@ -36,7 +36,6 @@ import { getNormalPath } from '@/utils/ruoyi';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
const props = defineProps({ const props = defineProps({
// route object
item: { item: {
type: Object as PropType<RouteRecordRaw>, type: Object as PropType<RouteRecordRaw>,
required: true required: true
@ -85,7 +84,7 @@ const resolvePath = (routePath: string, routeQuery?: string): any => {
if (isExternal(routePath)) { if (isExternal(routePath)) {
return routePath; return routePath;
} }
if (isExternal(props.basePath)) { if (isExternal(props.basePath as string)) {
return props.basePath; return props.basePath;
} }
if (routeQuery) { if (routeQuery) {

View File

@ -13,7 +13,7 @@
:collapse-transition="false" :collapse-transition="false"
mode="vertical" mode="vertical"
> >
<sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" /> <sidebar-item v-for="(r, index) in sidebarRouters" :key="r.path + index" :item="r" :base-path="r.path" />
</el-menu> </el-menu>
</transition> </transition>
</el-scrollbar> </el-scrollbar>
@ -28,7 +28,8 @@ import useAppStore from '@/store/modules/app';
import useSettingsStore from '@/store/modules/settings'; import useSettingsStore from '@/store/modules/settings';
import usePermissionStore from '@/store/modules/permission'; import usePermissionStore from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { proxy } = getCurrentInstance();
const route = useRoute(); const route = useRoute();
const appStore = useAppStore(); const appStore = useAppStore();

View File

@ -7,6 +7,7 @@
<script setup lang="ts"> <script setup lang="ts">
import useTagsViewStore from '@/store/modules/tagsView'; import useTagsViewStore from '@/store/modules/tagsView';
import { TagView } from 'vue-router'; import { TagView } from 'vue-router';
const tagAndTagSpacing = ref(4); const tagAndTagSpacing = ref(4);
const scrollContainerRef = ref<ElScrollbarInstance>(); const scrollContainerRef = ref<ElScrollbarInstance>();

View File

@ -143,7 +143,7 @@ const moveToCurrentTag = () => {
scrollPaneRef.value?.moveToTarget(r); scrollPaneRef.value?.moveToTarget(r);
// when query is different then update // when query is different then update
if (r.fullPath !== route.fullPath) { if (r.fullPath !== route.fullPath) {
useTagsViewStore().updateVisitedView(route); useTagsViewStore().updateVisitedView(route as any);
} }
} }
} }
@ -163,14 +163,14 @@ const closeSelectedTag = (view: TagView) => {
}); });
}; };
const closeRightTags = () => { const closeRightTags = () => {
proxy?.$tab.closeRightPage(selectedTag.value).then((visitedViews) => { proxy?.$tab.closeRightPage(selectedTag.value).then((visitedViews: TagView[]) => {
if (!visitedViews.find((i) => i.fullPath === route.fullPath)) { if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) {
toLastView(visitedViews); toLastView(visitedViews);
} }
}); });
}; };
const closeLeftTags = () => { const closeLeftTags = () => {
proxy?.$tab.closeLeftPage(selectedTag.value).then((visitedViews) => { proxy?.$tab.closeLeftPage(selectedTag.value).then((visitedViews: TagView[]) => {
if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) { if (!visitedViews.find((i: TagView) => i.fullPath === route.fullPath)) {
toLastView(visitedViews); toLastView(visitedViews);
} }

View File

@ -1,6 +1,6 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
// global css // global css
import 'uno.css'; import 'virtual:uno.css';
import '@/assets/styles/index.scss'; import '@/assets/styles/index.scss';
import 'element-plus/theme-chalk/dark/css-vars.css'; import 'element-plus/theme-chalk/dark/css-vars.css';

View File

@ -8,7 +8,6 @@ import { isRelogin } from '@/utils/request';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import useSettingsStore from '@/store/modules/settings'; import useSettingsStore from '@/store/modules/settings';
import usePermissionStore from '@/store/modules/permission'; import usePermissionStore from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router';
NProgress.configure({ showSpinner: false }); NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register', '/social-callback']; const whiteList = ['/login', '/register', '/social-callback'];
@ -36,12 +35,14 @@ router.beforeEach(async (to, from, next) => {
isRelogin.show = false; isRelogin.show = false;
const accessRoutes = await usePermissionStore().generateRoutes(); const accessRoutes = await usePermissionStore().generateRoutes();
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
accessRoutes.forEach((route: RouteRecordRaw) => { accessRoutes.forEach((route) => {
if (!isHttp(route.path)) { if (!isHttp(route.path)) {
router.addRoute(route); // 动态添加可访问路由表 router.addRoute(route); // 动态添加可访问路由表
} }
}); });
next({ ...to, replace: true }); // hack方法 确保addRoutes已完成 const n = { ...to, replace: true };
console.log(n);
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
} }
} else { } else {
next(); next();

View File

@ -123,7 +123,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
}); });
}; };
const updateVisitedView = (view: TagView | RouteLocationNormalized): void => { const updateVisitedView = (view: TagView): void => {
for (let v of visitedViews.value) { for (let v of visitedViews.value) {
if (v.path === view.path) { if (v.path === view.path) {
v = Object.assign(v, view); v = Object.assign(v, view);
@ -170,7 +170,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
}); });
}; };
const addCachedView = (view: TagView | RouteLocationNormalized): void => { const addCachedView = (view: TagView): void => {
const viewName = view.name as string; const viewName = view.name as string;
if (!viewName) return; if (!viewName) return;
if (cachedViews.value.includes(viewName)) return; if (cachedViews.value.includes(viewName)) return;

View File

@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
declare module 'axios' { declare module 'axios' {
export interface AxiosResponse<T = any> { interface AxiosResponse<T = any> {
code: number; code: number;
msg: string; msg: string;
rows: T; rows: T;

View File

@ -4,6 +4,7 @@ declare global {
declare type ElFormInstance = ep.FormInstance; declare type ElFormInstance = ep.FormInstance;
declare type ElTableInstance = ep.TableInstance; declare type ElTableInstance = ep.TableInstance;
declare type ElUploadInstance = ep.UploadInstance; declare type ElUploadInstance = ep.UploadInstance;
declare type ElScrollbarInstance = ep.ScrollbarInstance;
declare type ElTreeInstance = InstanceType<typeof ep.ElTree>; declare type ElTreeInstance = InstanceType<typeof ep.ElTree>;
declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>; declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>;
declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>; declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>;
@ -24,7 +25,6 @@ declare global {
declare type ElColorPickerInstance = InstanceType<typeof ep.ElColorPicker>; declare type ElColorPickerInstance = InstanceType<typeof ep.ElColorPicker>;
declare type ElRateInstance = InstanceType<typeof ep.ElRate>; declare type ElRateInstance = InstanceType<typeof ep.ElRate>;
declare type ElSliderInstance = InstanceType<typeof ep.ElSlider>; declare type ElSliderInstance = InstanceType<typeof ep.ElSlider>;
declare type ElScrollbarInstance = InstanceType<typeof ep.ElScrollbar>;
declare type TransferKey = ep.TransferKey; declare type TransferKey = ep.TransferKey;
declare type CheckboxValueType = ep.CheckboxValueType; declare type CheckboxValueType = ep.CheckboxValueType;

54
src/types/env.d.ts vendored
View File

@ -4,60 +4,6 @@ declare module '*.vue' {
export default Component; export default Component;
} }
declare module '*.avif' {
const src: string;
export default src;
}
declare module '*.bmp' {
const src: string;
export default src;
}
declare module '*.gif' {
const src: string;
export default src;
}
declare module '*.jpg' {
const src: string;
export default src;
}
declare module '*.jpeg' {
const src: string;
export default src;
}
declare module '*.png' {
const src: string;
export default src;
}
declare module '*.webp' {
const src: string;
export default src;
}
declare module '*.svg' {
const src: string;
export default src;
}
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
// 环境变量 // 环境变量
interface ImportMetaEnv { interface ImportMetaEnv {
VITE_APP_TITLE: string; VITE_APP_TITLE: string;

View File

@ -1,4 +1,5 @@
import type { ComponentInternalInstance as ComponentInstance, PropType as VuePropType } from 'vue/runtime-core'; import type { ComponentInternalInstance as ComponentInstance } from 'vue/runtime-core';
import type { PropType as VuePropType } from 'vue';
import { LanguageEnum } from '@/enums/LanguageEnum'; import { LanguageEnum } from '@/enums/LanguageEnum';
declare global { declare global {

View File

@ -30,3 +30,8 @@ declare module '@vue/runtime-core' {
parseTime: typeof parseTime; parseTime: typeof parseTime;
} }
} }
declare module 'vform3-builds' {
const content: any;
export = content;
}

View File

@ -16,6 +16,7 @@ declare module 'vue-router' {
roles?: string[]; roles?: string[];
alwaysShow?: boolean; alwaysShow?: boolean;
query?: string; query?: string;
parentPath?: string;
} }
interface _RouteLocationBase { interface _RouteLocationBase {

View File

@ -1,4 +0,0 @@
declare module 'vform3-builds' {
const content: any;
export = content;
}

View File

@ -89,7 +89,7 @@ export const byteLength = (str: string) => {
* @returns {Array} * @returns {Array}
*/ */
export const cleanArray = (actual: Array<any>) => { export const cleanArray = (actual: Array<any>) => {
const newArray = []; const newArray: any[] = [];
for (let i = 0; i < actual.length; i++) { for (let i = 0; i < actual.length; i++) {
if (actual[i]) { if (actual[i]) {
newArray.push(actual[i]); newArray.push(actual[i]);

View File

@ -68,7 +68,7 @@ export const selectDictLabel = (datas: any, value: number | string) => {
if (value === undefined) { if (value === undefined) {
return ''; return '';
} }
const actions = []; const actions: Array<string | number> = [];
Object.keys(datas).some((key) => { Object.keys(datas).some((key) => {
if (datas[key].value == '' + value) { if (datas[key].value == '' + value) {
actions.push(datas[key].label); actions.push(datas[key].label);

View File

@ -63,6 +63,7 @@
<script setup name="Online" lang="ts"> <script setup name="Online" lang="ts">
import { forceLogout, list as initData } from '@/api/monitor/online'; import { forceLogout, list as initData } from '@/api/monitor/online';
import { OnlineQuery, OnlineVO } from '@/api/monitor/online/types'; import { OnlineQuery, OnlineVO } from '@/api/monitor/online/types';
import api from '@/api/system/user';
import { to } from 'await-to-js'; import { to } from 'await-to-js';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="p-2"> <div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px"> <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
<el-form-item label="操作地址" prop="operIp"> <el-form-item label="操作地址" prop="operIp">

View File

@ -50,7 +50,8 @@ import { UserQuery } from '@/api/system/user/types';
const props = defineProps({ const props = defineProps({
roleId: { roleId: {
type: [Number, String] type: [Number, String],
required: true
} }
}); });

View File

@ -372,7 +372,8 @@ const initFormData: UserForm = {
postIds: [], postIds: [],
roleIds: [] roleIds: []
}; };
const data = reactive<PageData<UserForm, UserQuery>>({
const initData: PageData<UserForm, UserQuery> = {
form: { ...initFormData }, form: { ...initFormData },
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -380,7 +381,8 @@ const data = reactive<PageData<UserForm, UserQuery>>({
userName: '', userName: '',
phonenumber: '', phonenumber: '',
status: '', status: '',
deptId: '' deptId: '',
roleId: ''
}, },
rules: { rules: {
userName: [ userName: [
@ -417,7 +419,8 @@ const data = reactive<PageData<UserForm, UserQuery>>({
} }
] ]
} }
}); };
const data = reactive<PageData<UserForm, UserQuery>>(initData);
const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data); const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data);

View File

@ -51,14 +51,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import { authUnlock, authBinding } from '@/api/system/social/auth'; import { authUnlock, authBinding } from '@/api/system/social/auth';
import { PropType } from 'vue'; import { propTypes } from '@/utils/propTypes';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({ const props = defineProps({
auths: { auths: propTypes.any.isRequired
type: Object as PropType<any>
}
}); });
const auths = computed(() => props.auths); const auths = computed(() => props.auths);

View File

@ -60,6 +60,7 @@ import 'vue-cropper/dist/index.css';
import { VueCropper } from 'vue-cropper'; import { VueCropper } from 'vue-cropper';
import { uploadAvatar } from '@/api/system/user'; import { uploadAvatar } from '@/api/system/user';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { UploadRawFile } from 'element-plus';
interface Options { interface Options {
img: string | any; // img: string | any; //
@ -118,7 +119,7 @@ const changeScale = (num: number) => {
cropper.value.changeScale(num); cropper.value.changeScale(num);
}; };
/** 上传预处理 */ /** 上传预处理 */
const beforeUpload = (file: any) => { const beforeUpload = (file: UploadRawFile): any => {
if (file.type.indexOf('image/') == -1) { if (file.type.indexOf('image/') == -1) {
proxy?.$modal.msgError('文件格式错误,请上传图片类型,如JPGPNG后缀的文件。'); proxy?.$modal.msgError('文件格式错误,请上传图片类型,如JPGPNG后缀的文件。');
} else { } else {
@ -138,7 +139,7 @@ const uploadImg = async () => {
const res = await uploadAvatar(formData); const res = await uploadAvatar(formData);
open.value = false; open.value = false;
options.img = res.data.imgUrl; options.img = res.data.imgUrl;
userStore.setAvatar(options.img as string); userStore.setAvatar(options.img);
proxy?.$modal.msgSuccess('修改成功'); proxy?.$modal.msgSuccess('修改成功');
visible.value = false; visible.value = false;
}); });

View File

@ -32,7 +32,7 @@ const props = defineProps({
const userForm = computed(() => props.user); const userForm = computed(() => props.user);
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userRef = ref<ElFormInstance>(); const userRef = ref<ElFormInstance>();
const rules = ref<ElFormRules>({ const rule: ElFormRules = {
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }], nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
email: [ email: [
{ required: true, message: '邮箱地址不能为空', trigger: 'blur' }, { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
@ -50,7 +50,8 @@ const rules = ref<ElFormRules>({
}, },
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' } { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }
] ]
}); };
const rules = ref<ElFormRules>(rule);
/** 提交按钮 */ /** 提交按钮 */
const submit = () => { const submit = () => {

View File

@ -228,16 +228,16 @@ import { propTypes } from '@/utils/propTypes';
interface MenuOptionsType { interface MenuOptionsType {
menuId: number | string; menuId: number | string;
menuName: string; menuName: string;
children: MenuOptionsType[] | undefined; children?: MenuOptionsType[];
} }
const { proxy } = getCurrentInstance();
const subColumns = ref<any>([]); const subColumns = ref<any>([]);
const menuOptions = ref<Array<MenuOptionsType>>([]); const menuOptions = ref<Array<MenuOptionsType>>([]);
const { proxy } = getCurrentInstance();
const props = defineProps({ const props = defineProps({
info: propTypes.any.def(null), info: propTypes.any.isRequired,
tables: propTypes.any.def(null) tables: propTypes.any.isRequired
}); });
const infoForm = computed(() => props.info); const infoForm = computed(() => props.info);
@ -276,6 +276,7 @@ const getMenuTreeselect = async () => {
const res = await listMenu(); const res = await listMenu();
res.data.forEach((m) => (m.menuId = m.menuId.toString())); res.data.forEach((m) => (m.menuId = m.menuId.toString()));
const data = proxy?.handleTree<MenuOptionsType>(res.data, 'menuId'); const data = proxy?.handleTree<MenuOptionsType>(res.data, 'menuId');
if (data) { if (data) {
menuOptions.value = data; menuOptions.value = data;
} }

View File

@ -2,21 +2,25 @@
"compilerOptions": { "compilerOptions": {
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"useDefineForClassFields": true, // "useDefineForClassFields": true,
"moduleResolution": "node", "moduleResolution": "bundler",
"strict": true, "strict": true,
"jsx": "preserve", "jsx": "preserve",
"sourceMap": true, "sourceMap": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": true, "esModuleInterop": true,
"strictFunctionTypes": false,
"lib": ["esnext", "dom"], "lib": ["esnext", "dom"],
"noImplicitAny": false,
"baseUrl": ".", "baseUrl": ".",
"allowJs": true, "allowJs": true,
"experimentalDecorators": true,
"paths": { "paths": {
"@/*": ["src/*"] "@/*": ["src/*"]
}, },
"types": ["vite/client"], "types": ["vite/client"],
"skipLibCheck": true, "skipLibCheck": true,
"removeComments": true,
// //
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true

33
uno.config.ts Normal file
View File

@ -0,0 +1,33 @@
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
presetWebFonts,
transformerDirectives,
transformerVariantGroup
} from 'unocss';
export default defineConfig({
shortcuts: {
'panel-title':
'pb-[5px] font-sans leading-[1.1] font-medium text-base text-[#6379bb] border-b border-b-solid border-[var(--el-border-color-light)] mb-5 mt-0'
},
theme: {
colors: {
primary: 'var(--el-color-primary)',
primary_dark: 'var(--el-color-primary-light-5)'
}
},
presets: [
presetUno(),
presetAttributify(),
presetIcons(),
presetTypography(),
presetWebFonts({
fonts: {}
})
],
transformers: [transformerDirectives(), transformerVariantGroup()]
});

View File

@ -1,6 +1,6 @@
import compression from 'vite-plugin-compression'; import compression from 'vite-plugin-compression';
export default function createCompression(env: any) { export default (env: any) => {
const { VITE_BUILD_COMPRESS } = env; const { VITE_BUILD_COMPRESS } = env;
const plugin: any[] = []; const plugin: any[] = [];
if (VITE_BUILD_COMPRESS) { if (VITE_BUILD_COMPRESS) {
@ -25,4 +25,4 @@ export default function createCompression(env: any) {
} }
} }
return plugin; return plugin;
} };

View File

@ -9,14 +9,14 @@ import createSetupExtend from './setup-extend';
import path from 'path'; import path from 'path';
export default (viteEnv: any, isBuild = false): [] => { export default (viteEnv: any, isBuild = false): [] => {
const vitePlusgins: any = []; const vitePlugins: any = [];
vitePlusgins.push(vue()); vitePlugins.push(vue());
vitePlusgins.push(createUnoCss()); vitePlugins.push(createUnoCss());
vitePlusgins.push(createAutoImport(path)); vitePlugins.push(createAutoImport(path));
vitePlusgins.push(createComponents(path)); vitePlugins.push(createComponents(path));
vitePlusgins.push(createCompression(viteEnv)); vitePlugins.push(createCompression(viteEnv));
vitePlusgins.push(createIcons()); vitePlugins.push(createIcons());
vitePlusgins.push(createSvgIconsPlugin(path, isBuild)); vitePlugins.push(createSvgIconsPlugin(path, isBuild));
vitePlusgins.push(createSetupExtend()); vitePlugins.push(createSetupExtend());
return vitePlusgins; return vitePlugins;
}; };

View File

@ -1,14 +1,7 @@
import UnoCss from 'unocss/vite'; import UnoCss from 'unocss/vite';
import { presetUno, presetAttributify, presetIcons } from 'unocss';
export default () => { export default () => {
return UnoCss({ return UnoCss({
presets: [presetUno(), presetAttributify(), presetIcons()],
// rules: [['search', {}]],
shortcuts: {
'panel-title':
'pb-[5px] font-sans leading-[1.1] font-medium text-base text-[#6379bb] border-b border-b-solid border-[var(--el-border-color-light)] mb-5 mt-0'
},
hmrTopLevelAwait: false // unocss默认是true低版本浏览器是不支持的启动后会报错 hmrTopLevelAwait: false // unocss默认是true低版本浏览器是不支持的启动后会报错
}); });
}; };