项目启动优化

This commit is contained in:
2026-05-09 17:04:58 +08:00
parent 4315f556c6
commit 8904cc8868
3 changed files with 60 additions and 20 deletions
+13 -1
View File
@@ -1,3 +1,15 @@
# Vue 3 + Vite # 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
```
+43 -17
View File
@@ -33,9 +33,7 @@
</el-form-item> </el-form-item>
<el-form-item label="筛选"> <el-form-item label="筛选">
<div class="checkbox-group"> <div class="checkbox-group">
<el-checkbox v-model="tOpenGainLt101"> <el-checkbox v-model="tOpenGainLt101"> T开盘小于1% </el-checkbox>
T开盘小于1%
</el-checkbox>
<el-checkbox v-model="breakTimeBefore1100"> <el-checkbox v-model="breakTimeBefore1100">
11点前炸板 11点前炸板
</el-checkbox> </el-checkbox>
@@ -124,7 +122,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatSignedPct(row.t_pct_chg) }}</template> <template #default="{ row }">{{
formatSignedPct(row.t_pct_chg)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="t_open_gain_lt_101" prop="t_open_gain_lt_101"
@@ -193,7 +193,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatSignedPct(row.next_high_profit_pct) }}</template> <template #default="{ row }">{{
formatSignedPct(row.next_high_profit_pct)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="next_open_pct_chg" prop="next_open_pct_chg"
@@ -202,7 +204,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatSignedPct(row.next_open_pct_chg) }}</template> <template #default="{ row }">{{
formatSignedPct(row.next_open_pct_chg)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="market" prop="market"
@@ -225,7 +229,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.t_open) }}</template> <template #default="{ row }">{{
formatPrice(row.t_open)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="t_open_pct_chg" prop="t_open_pct_chg"
@@ -234,7 +240,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatSignedPct(row.t_open_pct_chg) }}</template> <template #default="{ row }">{{
formatSignedPct(row.t_open_pct_chg)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="t_high" prop="t_high"
@@ -243,7 +251,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.t_high) }}</template> <template #default="{ row }">{{
formatPrice(row.t_high)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="t_close" prop="t_close"
@@ -252,7 +262,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.t_close) }}</template> <template #default="{ row }">{{
formatPrice(row.t_close)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="has_tushare_break_data" prop="has_tushare_break_data"
@@ -278,7 +290,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.next_open) }}</template> <template #default="{ row }">{{
formatPrice(row.next_open)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="next_high" prop="next_high"
@@ -287,7 +301,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.next_high) }}</template> <template #default="{ row }">{{
formatPrice(row.next_high)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="next_low" prop="next_low"
@@ -296,7 +312,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.next_low) }}</template> <template #default="{ row }">{{
formatPrice(row.next_low)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="next_close" prop="next_close"
@@ -305,7 +323,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatPrice(row.next_close) }}</template> <template #default="{ row }">{{
formatPrice(row.next_close)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="next_low_loss_pct" prop="next_low_loss_pct"
@@ -314,7 +334,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatSignedPct(row.next_low_loss_pct) }}</template> <template #default="{ row }">{{
formatSignedPct(row.next_low_loss_pct)
}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="next_close_pct_chg" prop="next_close_pct_chg"
@@ -323,7 +345,9 @@
align="right" align="right"
sortable sortable
> >
<template #default="{ row }">{{ formatSignedPct(row.next_close_pct_chg) }}</template> <template #default="{ row }">{{
formatSignedPct(row.next_close_pct_chg)
}}</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
@@ -390,7 +414,9 @@ const paginationLayout = computed(() =>
: "total, sizes, prev, pager, next, jumper", : "total, sizes, prev, pager, next, jumper",
); );
const paginationPagerCount = computed(() => (viewportWidth.value <= 820 ? 5 : 7)); const paginationPagerCount = computed(() =>
viewportWidth.value <= 820 ? 5 : 7,
);
onMounted(async () => { onMounted(async () => {
window.addEventListener("resize", syncViewport); window.addEventListener("resize", syncViewport);
+4 -2
View File
@@ -2,6 +2,8 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import path from 'path' import path from 'path'
const apiProxyTarget = process.env.VITE_API_PROXY_TARGET || 'http://127.0.0.1:18080'
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {
@@ -12,9 +14,9 @@ export default defineConfig({
port: 5173, // 你的端口号 port: 5173, // 你的端口号
proxy: { proxy: {
'/api/v1': { '/api/v1': {
target: 'http://localhost:18080', target: apiProxyTarget,
changeOrigin: true changeOrigin: true
} }
} }
} }
}) })