From 8904cc8868167f0343ac50f1338deb9a47203241 Mon Sep 17 00:00:00 2001 From: yangfan <784310601@qq.com> Date: Sat, 9 May 2026 17:04:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=AF=E5=8A=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++- src/views/stock/BreakNextPerformance.vue | 60 +++++++++++++++++------- vite.config.js | 6 ++- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b3f781c..3f6c004 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # Vue 3 + Vite -# 运行项目使用:npm run dev +# 运行项目使用 + +先启动后端服务,默认接口地址为 `http://127.0.0.1:18080`。 + +```sh +npm run dev +``` + +如果后端端口或地址不同,可以启动前端时覆盖代理目标: + +```sh +VITE_API_PROXY_TARGET=http://127.0.0.1:18080 npm run dev +``` diff --git a/src/views/stock/BreakNextPerformance.vue b/src/views/stock/BreakNextPerformance.vue index ced798b..6bcae98 100644 --- a/src/views/stock/BreakNextPerformance.vue +++ b/src/views/stock/BreakNextPerformance.vue @@ -33,9 +33,7 @@
- - T开盘小于1% - + T开盘小于1% 11点前炸板 @@ -124,7 +122,9 @@ align="right" sortable > - + - + - + - + - + - + - + - + - + - + - + - + - +
@@ -390,7 +414,9 @@ const paginationLayout = computed(() => : "total, sizes, prev, pager, next, jumper", ); -const paginationPagerCount = computed(() => (viewportWidth.value <= 820 ? 5 : 7)); +const paginationPagerCount = computed(() => + viewportWidth.value <= 820 ? 5 : 7, +); onMounted(async () => { window.addEventListener("resize", syncViewport); diff --git a/vite.config.js b/vite.config.js index 39527ce..97d34c3 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,6 +2,8 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' +const apiProxyTarget = process.env.VITE_API_PROXY_TARGET || 'http://127.0.0.1:18080' + export default defineConfig({ plugins: [vue()], resolve: { @@ -12,9 +14,9 @@ export default defineConfig({ port: 5173, // 你的端口号 proxy: { '/api/v1': { - target: 'http://localhost:18080', + target: apiProxyTarget, changeOrigin: true } } } -}) \ No newline at end of file +})