From 68bcdb309e93c4c7fb8bd7cb0d554bcb977a954e Mon Sep 17 00:00:00 2001 From: LingandRX Date: Wed, 1 Jan 2025 12:04:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(login):=20=E5=AE=9E=E7=8E=B0=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 AboutView.vue 中的多余代码- 完善了 CustomLogin.vue 中的登录逻辑,添加了表单提交后的处理 - 更新了 CustomNews.vue 中的数据请求方式- 删除了不再使用的 db.json 文件 - 在 package.json 中添加了 serve 脚本 - 在 vite.config.js 中配置了服务器代理 --- db.json | 10 ---------- package.json | 1 + src/components/CustomLogin.vue | 34 ++++++++++++++++++++++------------ src/components/CustomNews.vue | 12 ++++++++++-- src/views/AboutView.vue | 7 ------- vite.config.js | 5 +++++ 6 files changed, 38 insertions(+), 31 deletions(-) delete mode 100644 db.json diff --git a/db.json b/db.json deleted file mode 100644 index c2335a6..0000000 --- a/db.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "users": [ - { - "id": 1, - "username": "test", - "password": "test", - "token": "123456" - } - ] -} \ No newline at end of file diff --git a/package.json b/package.json index 0843240..5082259 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "serve": "vite serve", "preview": "vite preview", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore", "format": "prettier --write src/" diff --git a/src/components/CustomLogin.vue b/src/components/CustomLogin.vue index 6c35da8..45b8051 100644 --- a/src/components/CustomLogin.vue +++ b/src/components/CustomLogin.vue @@ -1,6 +1,7 @@ diff --git a/vite.config.js b/vite.config.js index 26a21a9..d114b5b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -14,5 +14,10 @@ export default defineConfig({ alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } + }, + server: { + proxy: { + '/api': 'http://localhost:3000', // 代理 API 请求 + } } })