demo: 加 Vue 前端到 examples/basic-admin/web
为了端到端验证 Shrimp 框架,把 hand-admin 前端拷进 examples/basic-admin/web
作为临时演示用前端,@shrimp alias 直接指向同仓 src/,免构建。
修改要点:
- web/vite.config.ts: @shrimp 改成 ../../../src; proxy /admin-api 到 :3100
- web/tsconfig.json: 同步 @shrimp 路径; 删掉 hand-server-2 的 paths
- web/src/locales: 删掉 matter_*/zerobase 业务 key
- web/src/module: 删掉 matter_*/zerobase 业务 vue,只留 user/role/FieldRelativeTime
- examples/basic-admin/index.ts:
- mount 到 /admin-api/* 而不是 /api/*
- 加 /config /login /me 端点 (mock super-admin operator,固定 token)
- DemoShrimp 子类覆盖 getMenuTree 用模块自身 label
- MemoryShrimpCrud 的 getRelatedCrud 手动 wire 到 crudRegistry,
populate 才能跑 (后续 70→90 改进项)
curl 已验证 /config /login /me /product/list 全通,tagIds_label 正确旁挂。
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import * as path from "path";
|
||||
|
||||
// shrimp-server/examples/basic-admin/web/vite.config.ts
|
||||
// 这是 examples 临时演示前端,@shrimp 直接指向同仓 src/
|
||||
export default defineConfig({
|
||||
base: '/',
|
||||
resolve: {
|
||||
alias:
|
||||
[
|
||||
{
|
||||
find: '@',
|
||||
replacement: path.resolve(__dirname, './src')
|
||||
},
|
||||
{
|
||||
find: '@shrimp',
|
||||
replacement: path.resolve(__dirname, '../../../src')
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [vue({ reactivityTransform: true })],
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
"/admin-api": {
|
||||
target: "http://localhost:3100",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/api": {
|
||||
target: "http://localhost:3100",
|
||||
changeOrigin: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user