Skip to content

Commit f9385bf

Browse files
committed
feat:update docs
1 parent 8a53452 commit f9385bf

File tree

8 files changed

+30
-12
lines changed

8 files changed

+30
-12
lines changed

docs/docs/tutorial-basics/插件配置.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sidebar_position: 10
99
本框架插件机制完全继承 Vite 插件体系,插件使用方式通 Vite 保持一致。例如:
1010

1111
```js
12-
// vite.config.js
12+
// viter.config.ts
1313
import legacy from '@vitejs/plugin-legacy';
1414
import { defineConfig } from 'viter';
1515

docs/docs/tutorial-basics/构建配置.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ sidebar_position: 11
44

55
# 构建配置
66

7-
Viter 构建配置在 [Vite 构建配置](https://cn.vitejs.dev/config/#build-options)的基础上,追加了如下配置:
7+
Viter 构建配置在 [Vite 构建配置](https://cn.vitejs.dev/config/#build-options) 的基础上,追加了如下配置:
88

99
### runtimePublicPath
1010

1111
用于启用运行时的 publicPath ,详见运行时配置章节。
1212

13-
### BuildMode
13+
### buildMode
1414

1515
- Type: `'single' | 'split' | 'split-js'`
1616

@@ -31,3 +31,17 @@ Viter 构建配置在 [Vite 构建配置](https://cn.vitejs.dev/config/#build-op
3131
- split-js
3232

3333
该模式关闭 css split,其余和 split 模式相同。
34+
35+
构建相关配置示例如下:
36+
37+
```js
38+
// viter.config.ts
39+
import { defineConfig } from 'viter';
40+
41+
export default defineConfig({
42+
build: {
43+
runtimePublicPath: { preloadBaseMarker: 'window.publicPath' },
44+
buildMode: 'single',
45+
},
46+
});
47+
```

docs/docs/tutorial-basics/路由.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 8
44

55
# 路由
66

7-
目前 Viter 暂时只支持单页应用(spa)场景。在该场景下,页面跳转都在浏览器端完成,由路由进行控制。
7+
目前 Viter 暂时只支持单页应用(spa)场景。在该场景下,页面跳转都在浏览器端完成,由路由进行控制。Viter 路由部分基于最新的 `react-router@6`, 相比于旧版本的路由,跳转和参数获取方式有所差异,具体可参考文档[《Migrating React Router v5 to v6》](https://github.com/remix-run/react-router/blob/main/docs/guides/migrating-5-to-6.md)
88

99
## 配置路由
1010

@@ -106,6 +106,8 @@ function xxx() {
106106
}
107107
```
108108

109+
### class 组件兼容
110+
109111
对于 class 组件,viter 提供高阶组件 withRouter,你可以用 withRouter 中注入的 history 来进行跳转。该方法主要用作兼容 class 组件和 react-router@5 部分写法,但我们强烈建议在增量的项目中使用 hooks 写法。
110112

111113
```js

docs/docs/tutorial-extras/后端集成.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ sidebar_position: 2
1515
1. 在你的 Viter 配置中配置入口文件和启用创建 `manifest`
1616

1717
```js
18-
// viter.config.js
18+
// viter.config.ts
1919
export default defineConfig({
2020
build: {
2121
// 在 outDir 中生成 manifest.json

packages/create-app/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# `create-vite-app`
1+
# `create-viter-app`
22

33
> TODO: description
44
55
## Usage
66

77
```js
8-
const createViteApp = require('icva');
9-
10-
// TODO: DEMONSTRATE API
8+
npm init @viterjs/app
119
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# `Viter`
2+
3+
Viter 是一款基于 Vite 的前端框架,目前主要服务与中后台开发者,其本质上是 Vite 的上层框架,扩展了路由等模块,让 Vite 技术能够更加便捷的在项目中得到应用。
4+
[进入官方文档](https://viterjs.github.io/)

packages/create-app/template-react-admin-ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"devDependencies": {
1515
"@types/react": "^17.0.0",
1616
"@types/react-dom": "^17.0.0",
17-
"@vitejs/plugin-react-refresh": "^1.3.1",
17+
"@vitejs/plugin-react": "^1.0.1",
1818
"typescript": "^4.1.2"
1919
}
2020
}

packages/create-app/template-react-admin-ts/viter.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { defineConfig } from 'viter';
2-
import reactRefresh from '@vitejs/plugin-react-refresh';
2+
import react from '@vitejs/plugin-react';
33

44
// https://vitejs.dev/config/
55
export default defineConfig({
6-
plugins: [reactRefresh()],
6+
plugins: [react()],
77
routes: [
88
{
99
path: '/',

0 commit comments

Comments
 (0)