feat: 提交请求封装
This commit is contained in:
parent
a4c360ee52
commit
294e818487
@ -2,7 +2,6 @@
|
|||||||
"*.{ts,tsx}": [
|
"*.{ts,tsx}": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"eslint --fix",
|
"eslint --fix",
|
||||||
"tsc --noEmit --pretty false --skipLibCheck",
|
|
||||||
"git add"
|
"git add"
|
||||||
],
|
],
|
||||||
"*.{json,js,jsx}": [
|
"*.{json,js,jsx}": [
|
||||||
@ -13,7 +12,6 @@
|
|||||||
"*.vue": [
|
"*.vue": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"eslint --fix",
|
"eslint --fix",
|
||||||
"vue-tsc --noEmit --skipLibCheck",
|
|
||||||
"git add"
|
"git add"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -53,5 +53,5 @@
|
|||||||
"pcss",
|
"pcss",
|
||||||
"postcss"
|
"postcss"
|
||||||
],
|
],
|
||||||
"cSpell.words": ["aeac", "esno", "radash", "unplugin"]
|
"cSpell.words": ["aeac", "esno", "radash", "unocss", "unplugin"]
|
||||||
}
|
}
|
||||||
|
|||||||
10
auto-imports.d.ts
vendored
Normal file
10
auto-imports.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
/* prettier-ignore */
|
||||||
|
// @ts-nocheck
|
||||||
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
// Generated by unplugin-auto-import
|
||||||
|
// biome-ignore lint: disable
|
||||||
|
export {}
|
||||||
|
declare global {
|
||||||
|
|
||||||
|
}
|
||||||
19
components.d.ts
vendored
Normal file
19
components.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
// Generated by unplugin-vue-components
|
||||||
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
|
// biome-ignore lint: disable
|
||||||
|
export {};
|
||||||
|
|
||||||
|
/* prettier-ignore */
|
||||||
|
declare module 'vue' {
|
||||||
|
export interface GlobalComponents {
|
||||||
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
|
ElForm: typeof import('element-plus/es')['ElForm']
|
||||||
|
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||||
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
|
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
||||||
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,30 +1,37 @@
|
|||||||
import antfu from '@antfu/eslint-config'
|
import antfu from "@antfu/eslint-config";
|
||||||
|
|
||||||
export default antfu({
|
export default antfu({
|
||||||
vue: {
|
vue: {
|
||||||
'vue/block-order': ['error', { // 块顺序
|
"vue/block-order": [
|
||||||
order: ['script', 'template', 'style'],
|
"error",
|
||||||
}],
|
{
|
||||||
|
// 块顺序
|
||||||
|
order: ["script", "template", "style"],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
typescript: true,
|
typescript: true,
|
||||||
stylistic: {
|
stylistic: {
|
||||||
indent: 2, // 缩进
|
indent: 2, // 缩进
|
||||||
semi: true, // 语句分号
|
semi: true, // 语句分号
|
||||||
quotes: 'single', // 单引号
|
quotes: "single", // 单引号
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'new-cap': ['off', { newIsCap: true, capIsNew: false }],
|
"new-cap": ["off", { newIsCap: true, capIsNew: false }],
|
||||||
'no-console': 'off', // 忽略console
|
"no-console": "off", // 忽略console
|
||||||
},
|
},
|
||||||
ignores: [
|
ignores: [
|
||||||
'**/dist/**',
|
"**/dist/**",
|
||||||
'**/node_modules/**',
|
"**/node_modules/**",
|
||||||
'**/build/**',
|
"**/build/**",
|
||||||
'**/lib/**',
|
"**/lib/**",
|
||||||
'**/es/**',
|
"**/es/**",
|
||||||
'**/types/**',
|
"**/types/**",
|
||||||
'**/public/**',
|
"**/public/**",
|
||||||
'**/vite.config.ts',
|
"**/vite.config.ts",
|
||||||
'**/eslint.config.js',
|
"**/eslint.config.js",
|
||||||
|
"./*.cjs",
|
||||||
|
"./*.js",
|
||||||
|
"./package.json",
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
|
|||||||
14
package.json
14
package.json
@ -7,10 +7,16 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc -b && vite build",
|
"build": "vue-tsc -b && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"prepare": "husky"
|
"prepare": "husky",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"fix": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.5.13"
|
"element-plus": "^2.9.8",
|
||||||
|
"hook-fetch": "^0.0.2",
|
||||||
|
"reset-css": "^5.0.2",
|
||||||
|
"vue": "^3.5.13",
|
||||||
|
"vue-router": "4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^4.12.0",
|
"@antfu/eslint-config": "^4.12.0",
|
||||||
@ -24,8 +30,12 @@
|
|||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^15.5.1",
|
"lint-staged": "^15.5.1",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
|
"sass-embedded": "^1.86.3",
|
||||||
"stylelint": "^16.18.0",
|
"stylelint": "^16.18.0",
|
||||||
"typescript": "~5.7.3",
|
"typescript": "~5.7.3",
|
||||||
|
"unocss": "66.1.0-beta.12",
|
||||||
|
"unplugin-auto-import": "^19.1.2",
|
||||||
|
"unplugin-vue-components": "^28.5.0",
|
||||||
"vite": "^6.3.1",
|
"vite": "^6.3.1",
|
||||||
"vue-tsc": "^2.2.8"
|
"vue-tsc": "^2.2.8"
|
||||||
},
|
},
|
||||||
|
|||||||
1277
pnpm-lock.yaml
generated
1277
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
29
src/App.vue
29
src/App.vue
@ -1,30 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts"></script>
|
||||||
import HelloWorld from './components/HelloWorld.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<router-view />
|
||||||
<a href="https://vite.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" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
.logo {
|
|
||||||
height: 6em;
|
|
||||||
padding: 1.5em;
|
|
||||||
will-change: filter;
|
|
||||||
transition: filter 300ms;
|
|
||||||
}
|
|
||||||
.logo:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #646cffaa);
|
|
||||||
}
|
|
||||||
.logo.vue:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #42b883aa);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
4
src/api/auth/index.ts
Normal file
4
src/api/auth/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import type { LoginDTO } from './types';
|
||||||
|
import { post } from '@/utils/request';
|
||||||
|
|
||||||
|
export const login = (data: LoginDTO) => post('/auth/login', data);
|
||||||
4
src/api/auth/types.ts
Normal file
4
src/api/auth/types.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface LoginDTO {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
1
src/api/index.ts
Normal file
1
src/api/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './auth';
|
||||||
@ -1,16 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue';
|
||||||
|
|
||||||
defineProps<{ msg: string }>()
|
const count = ref(0);
|
||||||
|
|
||||||
const count = ref(0)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1>{{ msg }}</h1>
|
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<button type="button" @click="count++">count is {{ count }}</button>
|
<button type="button" @click="count++">
|
||||||
|
count is {{ count }}
|
||||||
|
</button>
|
||||||
<p>
|
<p>
|
||||||
Edit
|
Edit
|
||||||
<code>components/HelloWorld.vue</code> to test HMR
|
<code>components/HelloWorld.vue</code> to test HMR
|
||||||
@ -19,19 +17,18 @@ const count = ref(0)
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Check out
|
Check out
|
||||||
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank">create-vue</a>, the official Vue + Vite starter
|
||||||
>create-vue</a
|
|
||||||
>, the official Vue + Vite starter
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Learn more about IDE Support for Vue in the
|
Learn more about IDE Support for Vue in the
|
||||||
<a
|
<a
|
||||||
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>Vue Docs Scaling up Guide</a
|
>Vue Docs Scaling up Guide</a>.
|
||||||
>.
|
</p>
|
||||||
|
<p class="read-the-docs">
|
||||||
|
Click on the Vite and Vue logos to learn more
|
||||||
</p>
|
</p>
|
||||||
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
13
src/main.ts
13
src/main.ts
@ -1,5 +1,10 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue';
|
||||||
import './style.css'
|
import App from './App.vue';
|
||||||
import App from './App.vue'
|
import router from './router';
|
||||||
|
import './styles/index.scss';
|
||||||
|
import 'virtual:uno.css';
|
||||||
|
|
||||||
createApp(App).mount('#app')
|
const app = createApp(App);
|
||||||
|
app.use(router);
|
||||||
|
|
||||||
|
app.mount('#app');
|
||||||
|
|||||||
43
src/pages/login/index.vue
Normal file
43
src/pages/login/index.vue
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { LoginDTO } from '@/api/auth/types';
|
||||||
|
import type { FormInstance } from 'element-plus';
|
||||||
|
import { login } from '@/api';
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance>();
|
||||||
|
|
||||||
|
const formModel = reactive<LoginDTO>({
|
||||||
|
username: '',
|
||||||
|
password: '',
|
||||||
|
});
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
await formRef.value?.validate();
|
||||||
|
const _res = await login(formModel);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error('请求错误:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="w-screen h-screen justify-center items-center flex bg-black">
|
||||||
|
<div class="max-w-[500px] w-full p-5 rounded bg-white/60 backdrop-blur-md">
|
||||||
|
<h1>登录</h1>
|
||||||
|
<el-form ref="formRef" :model="formModel">
|
||||||
|
<el-form-item label="用户名" name="username">
|
||||||
|
<el-input v-model="formModel.username" placeholder="请输入用户名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" name="password">
|
||||||
|
<el-input v-model="formModel.password" placeholder="请输入密码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSubmit">
|
||||||
|
登录
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
24
src/router/index.ts
Normal file
24
src/router/index.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||||
|
import { jwtGuard } from './permissions';
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{ path: '/', component: () => import('@/components/HelloWorld.vue') },
|
||||||
|
{
|
||||||
|
path: '/login',
|
||||||
|
name: 'login',
|
||||||
|
component: () => import('@/pages/login/index.vue'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHashHistory(),
|
||||||
|
routes,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.group('Routes');
|
||||||
|
console.log('routes', router.getRoutes());
|
||||||
|
console.groupEnd();
|
||||||
|
|
||||||
|
router.beforeEach(jwtGuard());
|
||||||
|
|
||||||
|
export default router;
|
||||||
7
src/router/permissions.ts
Normal file
7
src/router/permissions.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import type { NavigationGuard } from 'vue-router';
|
||||||
|
|
||||||
|
export function jwtGuard(): NavigationGuard {
|
||||||
|
return () => {
|
||||||
|
console.log('进入路由守卫');
|
||||||
|
};
|
||||||
|
}
|
||||||
13
src/router/types.ts
Normal file
13
src/router/types.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import type {
|
||||||
|
_Awaitable,
|
||||||
|
NavigationGuardNext,
|
||||||
|
NavigationGuardReturn,
|
||||||
|
RouteLocationNormalized,
|
||||||
|
RouteLocationNormalizedLoaded,
|
||||||
|
} from 'vue-router';
|
||||||
|
|
||||||
|
export type NavigationGuard = (
|
||||||
|
to: RouteLocationNormalized,
|
||||||
|
from: RouteLocationNormalizedLoaded,
|
||||||
|
next: NavigationGuardNext,
|
||||||
|
) => _Awaitable<NavigationGuardReturn>;
|
||||||
@ -1,79 +0,0 @@
|
|||||||
:root {
|
|
||||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
7
src/styles/element-plus.scss
Normal file
7
src/styles/element-plus.scss
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.el-form{
|
||||||
|
.el-form-item{
|
||||||
|
&:nth-last-child(1){
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/styles/index.scss
Normal file
6
src/styles/index.scss
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@import 'reset-css';
|
||||||
|
@import './element-plus.scss';
|
||||||
|
|
||||||
|
body{
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
32
src/utils/request.ts
Normal file
32
src/utils/request.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import hookFetch from 'hook-fetch';
|
||||||
|
import { sseTextDecoderPlugin } from 'hook-fetch/plugins';
|
||||||
|
|
||||||
|
interface BaseResponse {
|
||||||
|
code: number;
|
||||||
|
data: null;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const instance = hookFetch.create<BaseResponse, unknown, 'data'>({
|
||||||
|
baseURL: 'https://web.pandarobot.chat/api',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
plugins: [sseTextDecoderPlugin()],
|
||||||
|
});
|
||||||
|
|
||||||
|
function jwtPlugin() {
|
||||||
|
return {
|
||||||
|
name: 'jwt',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.use(jwtPlugin());
|
||||||
|
|
||||||
|
export const request = instance.request;
|
||||||
|
|
||||||
|
export const post = instance.post;
|
||||||
|
|
||||||
|
export const get = instance.get;
|
||||||
|
|
||||||
|
export default instance;
|
||||||
@ -2,12 +2,17 @@
|
|||||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
},
|
||||||
|
"types": ["element-plus/global"],
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"esModuleInterop": true,
|
||||||
"noUncheckedSideEffectImports": true
|
"noUncheckedSideEffectImports": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"files": [],
|
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "./tsconfig.app.json" },
|
{ "path": "./tsconfig.app.json" },
|
||||||
{ "path": "./tsconfig.node.json" }
|
{ "path": "./tsconfig.node.json" }
|
||||||
]
|
],
|
||||||
|
"files": []
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,21 +3,21 @@
|
|||||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"lib": ["ES2023"],
|
"lib": ["ES2023"],
|
||||||
|
"moduleDetection": "force",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"isolatedModules": true,
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"noEmit": true,
|
|
||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noEmit": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
"noUncheckedSideEffectImports": true
|
"noUncheckedSideEffectImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": ["vite.config.ts"]
|
||||||
|
|||||||
5
uno.config.ts
Normal file
5
uno.config.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { defineConfig } from 'unocss';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
// ...UnoCSS options
|
||||||
|
});
|
||||||
@ -1,7 +1,26 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from "vite";
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import AutoImport from "unplugin-auto-import/vite";
|
||||||
|
import Components from "unplugin-vue-components/vite";
|
||||||
|
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
||||||
|
import UnoCSS from "unocss/vite";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [
|
||||||
})
|
UnoCSS(),
|
||||||
|
vue(),
|
||||||
|
AutoImport({
|
||||||
|
resolvers: [ElementPlusResolver()],
|
||||||
|
}),
|
||||||
|
Components({
|
||||||
|
resolvers: [ElementPlusResolver()],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": path.resolve(__dirname, "./src"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user