@lark-apaas/coding-templates 0.1.36 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template-apex/README.md +2 -0
- package/template-vite-react/README.md +12 -13
package/package.json
CHANGED
package/template-apex/README.md
CHANGED
|
@@ -218,6 +218,8 @@ export default function DashboardPage() {
|
|
|
218
218
|
</Route>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
+
> **注意:** `BrowserRouter` 已在 `main.tsx` 中统一配置,`app.tsx` 中**禁止**再包裹 `BrowserRouter`,否则会报嵌套 Router 错误。
|
|
222
|
+
|
|
221
223
|
**新增页面步骤:**
|
|
222
224
|
|
|
223
225
|
1. 在 `client/src/pages/` 下新建页面目录(如 `SettingsPage`)和 `SettingsPage.tsx`
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
client/src/
|
|
19
|
-
├──
|
|
19
|
+
├── main.tsx # 入口(Provider 层级 + 样式引入,勿修改)
|
|
20
|
+
├── app.tsx # 路由配置
|
|
20
21
|
├── index.css # 全局样式 + 主题变量
|
|
21
22
|
├── components/ # 基础 UI 组件(禁止存放业务组件)
|
|
22
23
|
│ └── ui/ # shadcn/ui 内置组件(勿手动修改)
|
|
@@ -94,28 +95,26 @@ export default function DashboardPage() {
|
|
|
94
95
|
**替换后的路由示例:**
|
|
95
96
|
|
|
96
97
|
```tsx
|
|
97
|
-
import {
|
|
98
|
+
import { Routes, Route } from "react-router-dom";
|
|
98
99
|
import { Layout } from "@/components/layout";
|
|
99
100
|
import DashboardPage from "@/pages/DashboardPage/DashboardPage";
|
|
100
101
|
import NotFoundPage from "@/pages/NotFoundPage/NotFoundPage";
|
|
101
102
|
|
|
102
|
-
declare const __APP_BASE_PATH__: string;
|
|
103
|
-
|
|
104
103
|
export default function App() {
|
|
105
104
|
return (
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
</Routes>
|
|
114
|
-
</BrowserRouter>
|
|
105
|
+
<Routes>
|
|
106
|
+
<Route element={<Layout />}>
|
|
107
|
+
{/* 将 index 路由指向真实的业务首页 */}
|
|
108
|
+
<Route index element={<DashboardPage />} />
|
|
109
|
+
<Route path="*" element={<NotFoundPage />} />
|
|
110
|
+
</Route>
|
|
111
|
+
</Routes>
|
|
115
112
|
);
|
|
116
113
|
}
|
|
117
114
|
```
|
|
118
115
|
|
|
116
|
+
> **注意:** `BrowserRouter` 已在 `main.tsx` 中统一配置,`app.tsx` 中**禁止**再包裹 `BrowserRouter`,否则会报嵌套 Router 错误。
|
|
117
|
+
|
|
119
118
|
**新增页面步骤:**
|
|
120
119
|
|
|
121
120
|
1. 在 `client/src/pages/` 下新建页面目录(如 `SettingsPage`)和 `SettingsPage.tsx`
|