1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-04 22:41:24 +08:00

Built the basic ui framework

This commit is contained in:
2023-04-29 01:38:45 +08:00
parent a9c51a0d96
commit c512f635b7
30 changed files with 9177 additions and 679 deletions

19
ui/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,19 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
"no-cond-assign": "error",
"indent": ["error", 4]
}
}

8
ui/.prettierrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 4,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}

1
ui/env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/pinnacle.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
<title>Pinnacle OA</title>
</head>
<body>
<div id="app"></div>

9277
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,16 +5,45 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
"dev-host": "vite --host 0.0.0.0",
"build-only": "vite build",
"build": "run-p type-check build-only",
"preview": "vite preview",
"test:unit": "vitest --environment jsdom --root src/",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"vue": "^3.2.41"
"element-plus": "^2.3.4",
"vite-plugin-inspect": "^0.7.24",
"vue": "^3.2.47",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.2.0",
"typescript": "^4.6.4",
"vite": "^3.2.3",
"vue-tsc": "^1.0.9"
"@rushstack/eslint-patch": "^1.2.0",
"@iconify-json/ep": "^1.1.10",
"@types/jsdom": "^21.1.0",
"@types/node": "^18.14.2",
"@vitejs/plugin-vue": "^4.2.1",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.3.0",
"@vue/tsconfig": "^0.1.3",
"axios": "^1.4.0",
"eslint": "^8.34.0",
"eslint-plugin-vue": "^9.9.0",
"jsdom": "^21.1.0",
"mockjs": "^1.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"typescript": "^5.0.4",
"unplugin-auto-import": "^0.15.3",
"unplugin-element-plus": "^0.7.1",
"unplugin-icons": "^0.16.1",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.3.3",
"vitest": "^0.30.1",
"vue-tsc": "^1.6.1"
}
}
}

9
ui/public/pinnacle.svg Normal file
View File

@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"
class="icon" viewBox="0 0 1024 1024" version="1.1" width="64" height="64" fill="none">
<path d="M835.834131 664.947948H697.596636v63.99884h138.237495a33.919385 33.919385 0 0 0 0-63.99884z"
fill="#00D4FF"/>
<path d="M1009.270987 755.186312V255.99536a159.357112 159.357112 0 0 0-154.877193-147.197332h-146.557344v58.878933h154.877193a79.99855 79.99855 0 0 1 79.358562 79.99855v519.030592a79.99855 79.99855 0 0 1-79.358562 79.99855h-154.877193v58.878933h154.877193a147.197332 147.197332 0 0 0 146.557344-150.397274zM567.039002 0h-23.67957l-428.792229 80.638538A132.477599 132.477599 0 0 0 14.729013 204.1563v607.98898a140.15746 140.15746 0 0 0 99.83819 122.877773L543.359432 1023.98144h23.67957a104.318109 104.318109 0 0 0 106.238075-106.878062V106.878063A114.557924 114.557924 0 0 0 567.039002 0z m39.039293 917.103378a36.479339 36.479339 0 0 1-39.039293 39.67928h-9.599826L128.00696 867.824271a52.479049 52.479049 0 0 1-46.719153-55.678991v-607.98898A51.83906 51.83906 0 0 1 128.00696 148.477309l430.072205-81.278527h8.959837a41.599246 41.599246 0 0 1 39.039293 39.679281z"
fill="#00D4FF"/>
<path d="M850.553864 470.391474h-137.597506V537.590256h137.597506a31.99942 31.99942 0 0 0 33.919385-33.919385 31.359432 31.359432 0 0 0-33.919385-33.279397zM850.553864 275.835h-137.597506v67.198783h137.597506a31.99942 31.99942 0 0 0 33.919385-33.919386 31.359432 31.359432 0 0 0-33.919385-33.279397zM355.84283 170.236914a127.99768 127.99768 0 0 0-114.557923 131.197622 127.99768 127.99768 0 0 0 114.557923 127.997681 120.957808 120.957808 0 0 0 115.197912-127.997681 127.99768 127.99768 0 0 0-115.197912-131.197622z m0 191.996521c-27.519501 0-47.359142-26.239524-47.359141-63.998841s19.83964-63.99884 47.359141-63.99884 47.99913 26.239524 47.99913 63.99884S384.00232 364.793388 355.84283 364.793388zM417.281717 732.14673l63.99884 145.917355h74.878643L384.00232 494.711033H295.683921l-147.837321 319.9942h74.238655l40.319269-81.278526zM339.84312 567.669711L384.00232 664.947948H296.963898z"
fill="#00D4FF"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,31 +1,7 @@
<script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div>
<HelloWorld msg="Vite + Vue" />
<router-view></router-view>
</template>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
<script setup lang="ts"></script>
<style scoped></style>

View File

@@ -0,0 +1,63 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
em,
i {
font-style: normal
}
li {
list-style: none
}
img {
border: 0;
vertical-align: middle
}
button {
cursor: pointer
}
a {
color: #666;
text-decoration: none
}
button,
input {
font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
border: 0;
outline: none;
}
body {
-webkit-font-smoothing: antialiased;
background-color: #fff;
font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
color: #666
}
.hide,
.none {
display: none
}
.clearfix:after {
visibility: hidden;
clear: both;
display: block;
content: ".";
height: 0
}
.clearfix {
*zoom: 1
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img"
class="icon" viewBox="0 0 1024 1024" version="1.1" width="64" height="64">
<path d="M835.834131 664.947948H697.596636v63.99884h138.237495a33.919385 33.919385 0 0 0 0-63.99884z"/>
<path d="M1009.270987 755.186312V255.99536a159.357112 159.357112 0 0 0-154.877193-147.197332h-146.557344v58.878933h154.877193a79.99855 79.99855 0 0 1 79.358562 79.99855v519.030592a79.99855 79.99855 0 0 1-79.358562 79.99855h-154.877193v58.878933h154.877193a147.197332 147.197332 0 0 0 146.557344-150.397274zM567.039002 0h-23.67957l-428.792229 80.638538A132.477599 132.477599 0 0 0 14.729013 204.1563v607.98898a140.15746 140.15746 0 0 0 99.83819 122.877773L543.359432 1023.98144h23.67957a104.318109 104.318109 0 0 0 106.238075-106.878062V106.878063A114.557924 114.557924 0 0 0 567.039002 0z m39.039293 917.103378a36.479339 36.479339 0 0 1-39.039293 39.67928h-9.599826L128.00696 867.824271a52.479049 52.479049 0 0 1-46.719153-55.678991v-607.98898A51.83906 51.83906 0 0 1 128.00696 148.477309l430.072205-81.278527h8.959837a41.599246 41.599246 0 0 1 39.039293 39.679281z"/>
<path d="M850.553864 470.391474h-137.597506V537.590256h137.597506a31.99942 31.99942 0 0 0 33.919385-33.919385 31.359432 31.359432 0 0 0-33.919385-33.279397zM850.553864 275.835h-137.597506v67.198783h137.597506a31.99942 31.99942 0 0 0 33.919385-33.919386 31.359432 31.359432 0 0 0-33.919385-33.279397zM355.84283 170.236914a127.99768 127.99768 0 0 0-114.557923 131.197622 127.99768 127.99768 0 0 0 114.557923 127.997681 120.957808 120.957808 0 0 0 115.197912-127.997681 127.99768 127.99768 0 0 0-115.197912-131.197622z m0 191.996521c-27.519501 0-47.359142-26.239524-47.359141-63.998841s19.83964-63.99884 47.359141-63.99884 47.99913 26.239524 47.99913 63.99884S384.00232 364.793388 355.84283 364.793388zM417.281717 732.14673l63.99884 145.917355h74.878643L384.00232 494.711033H295.683921l-147.837321 319.9942h74.238655l40.319269-81.278526zM339.84312 567.669711L384.00232 664.947948H296.963898z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

Before

Width:  |  Height:  |  Size: 496 B

68
ui/src/auto-imports.d.ts vendored Normal file
View File

@@ -0,0 +1,68 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useLink: typeof import('vue-router')['useLink']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
}

16
ui/src/components.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}

View File

@@ -0,0 +1,23 @@
const PRODUCTION_NAME = 'Pinnacle OA'
const COLOR_PRODUCTION = '#00D4FF'
const COLOR_BACKGROUND = '#D8D8D8'
const COLOR_FONT_MAIN = '#4D4D4D'
const COLOR_FONT_SECONDARY = '#9E9E9E'
const SIZE_ICON_XS = '16px'
const SIZE_ICON_SM = '20px'
const SIZE_ICON_MD = '24px'
const SIZE_ICON_LG = '32px'
const SIZE_ICON_XL = '64px'
export {
PRODUCTION_NAME,
COLOR_PRODUCTION,
COLOR_BACKGROUND,
COLOR_FONT_MAIN,
COLOR_FONT_SECONDARY,
SIZE_ICON_XS,
SIZE_ICON_SM,
SIZE_ICON_MD,
SIZE_ICON_LG,
SIZE_ICON_XL
}

View File

@@ -1,5 +1,21 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import App from '@/App.vue'
import router from '@/router'
createApp(App).mount('#app')
import { PRODUCTION_NAME } from './constants/Common.constants.js'
import '@/assets/css/base.css'
router.beforeEach((to, from, next) => {
if (to.matched.length === 0) {
from.path ? next({ path: from.path }) : next('/')
} else {
if (to.meta.title) {
document.title = PRODUCTION_NAME + ' - ' + to.meta.title
}
}
})
const app = createApp(App)
app.use(router).mount('#app')

9
ui/src/pages/Main.vue Normal file
View File

@@ -0,0 +1,9 @@
<template><div></div></template>
<script>
export default {
name: 'MainPage'
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,9 @@
<template><div></div></template>
<script>
export default {
name: 'TodoPage'
}
</script>
<style scoped></style>

8
ui/src/router/index.ts Normal file
View File

@@ -0,0 +1,8 @@
import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: []
})
export default router

0
ui/src/services/index.ts Normal file
View File

0
ui/src/store/index.ts Normal file
View File

View File

@@ -1,81 +0,0 @@
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

0
ui/src/utils/common.ts Normal file
View File

12
ui/tsconfig.app.json Normal file
View File

@@ -0,0 +1,12 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

View File

@@ -1,18 +1,14 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"jsx": "preserve",
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"noEmit": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
]
}

View File

@@ -1,9 +1,8 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
"types": ["node"]
}
}

9
ui/tsconfig.vitest.json Normal file
View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.app.json",
"exclude": [],
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom"]
}
}

View File

@@ -1,7 +1,86 @@
import { fileURLToPath, URL } from 'node:url'
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import IconsResolver from 'unplugin-icons/resolver'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import Icons from 'unplugin-icons/vite'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import Inspect from 'vite-plugin-inspect'
const pathSrc = path.resolve(__dirname, 'src')
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()]
plugins: [
vue(),
AutoImport({
// 目标文件
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
/\.md$/ // .md
],
// Auto import functions from Vue, e.g. ref, reactive, toRef...
// 自动导入 Vue 相关函数ref, reactive, toRef 等
imports: ['vue', 'vue-router'],
// eslint报错解决
eslintrc: {
enabled: false, // Default `false`
filepath: '.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
// Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
// 自动导入 Element Plus 相关函数ElMessage, ElMessageBox... (带样式)
resolvers: [
// Auto import icon components
// 自动导入图标组件
IconsResolver({
prefix: 'icon',
alias: {
system: 'system-uicons'
},
enabledCollections: ['ep'],
customCollections: ['pinnacle']
}),
ElementPlusResolver()
],
dts: path.resolve(pathSrc, 'auto-imports.d.ts')
}),
Components({
resolvers: [
IconsResolver({
prefix: 'icon',
alias: {
system: 'system-uicons'
},
enabledCollections: ['ep'],
customCollections: ['pinnacle']
}),
ElementPlusResolver()
],
dts: path.resolve(pathSrc, 'components.d.ts')
}),
Icons({
compiler: 'vue3',
autoInstall: true,
customCollections: {
pinnacle: FileSystemIconLoader('src/assets/svg', (svg) =>
svg.replace(/^svg /, '<svg fill="currentColor"')
)
}
}),
Inspect()
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})

15
ui/vitest.config.ts Normal file
View File

@@ -0,0 +1,15 @@
import { fileURLToPath } from 'node:url'
import { mergeConfig } from 'vite'
import { configDefaults, defineConfig } from 'vitest/config'
import viteConfig from './vite.config'
export default mergeConfig(
viteConfig,
defineConfig({
test: {
environment: 'jsdom',
exclude: [...configDefaults.exclude, 'e2e/*'],
root: fileURLToPath(new URL('./', import.meta.url))
}
})
)