Skip to content

Commit 161934d

Browse files
committed
docs: update doc
1 parent dea146c commit 161934d

File tree

6 files changed

+61
-46
lines changed

6 files changed

+61
-46
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ yarn run lint
9090
- [Vue-cli3](https://cli.vuejs.org/guide/) used by the project.
9191
- Disable Eslint (not recommended): remove `eslintConfig` field in `package.json` and `vue.config.js` field `lintOnSave: false`
9292

93-
- Load on Demand: modify `/src/main.js` L7, append `import './core/lazy_use'` code.
93+
- Load on Demand: modify `/src/main.js` L14, replace to `import './core/lazy_use'` code.
9494

9595
- Customize Theme: `vue.config.js`
9696
eg:

docs/load-on-demand.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
2. 修改引入组件方式 (注意,这只是一个例子,请完整引入你所需要的组件)
3434

35-
文件 `@/components/use.js`
35+
文件 `@/core/lazy_lib/component_use.js`
3636

3737
```javascript
3838
import Vue from 'vue'
@@ -64,15 +64,15 @@
6464
```
6565

6666

67-
3. 最后在 `main.js` 中引入 `@/components/use.js` 文件即可,如下
67+
3. 最后在 `main.js` 中引入 `@/core/lazy_use.js` 文件即可,如下
6868

6969
```javascript
7070

7171
import Vue from 'vue'
7272
import App from './App'
7373

7474
// 引入 按需组件的统一引入文件
75-
import './components/use'
75+
import './core/use'
7676

7777
import './style/index.less'
7878

@@ -85,12 +85,6 @@
8585

8686
```
8787

88-
**具体完整实现可参考分支 [feature/demand_load](https://github.com./sendya/ant-design-pro-vue/tree/feature/demand_load)**
89-
90-
91-
92-
93-
9488

9589

9690
## 其他 减少打包大小

docs/multi-tabs.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
## 让框架支持打开的页面增加多标签,可随时切换
66

77
### 关于如何移除该功能 组件
8-
1. 移除 `/src/components/layouts/BasicLayout.vue` L3, L12, L19
8+
1. 移除 `/src/layouts/BasicLayout.vue` L44, L69, L80
99
```vue
10-
<multi-tab v-if="$store.getters.multiTab"></multi-tab>
10+
// L44
11+
<multi-tab v-if="multiTab"></multi-tab>
12+
13+
// L69
14+
import MultiTab from '@/components/MultiTab'
15+
16+
// L80
17+
MultiTab,
1118
```
1219
2. 移除 `/src/config/defaultSettings.js` L25
1320
@@ -17,4 +24,5 @@
1724
1825
5. 删除组件目录 `src/components/MultiTab`
1926
20-
> 以上 `L x` 均代表行N ,如 L3 = 行3
27+
> 以上 `L x` 均代表行N ,如 L3 = 行3
28+

src/components/Table/README.md

+33-25
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Table 重封装组件说明
3131
</template>
3232
3333
<script>
34-
import STable from '@/components/table/'
34+
import STable from '@/components'
3535
3636
export default {
3737
components: {
@@ -210,7 +210,7 @@ Table 重封装组件说明
210210
----
211211
> 除去 `a-table` 自带属性外,还而外提供了一些额外属性属性
212212
213-
213+
214214
| 属性 | 说明 | 类型 | 默认值 |
215215
| -------------- | ----------------------------------------------- | ----------------- | ------ |
216216
| alert | 设置是否显示表格信息栏 | [object, boolean] | null |
@@ -231,35 +231,43 @@ alert: {
231231
----
232232

233233
> 你可能需要为了与后端提供的接口返回结果一致而去修改以下代码:
234-
(需要注意的是,这里的修改是全局性的,意味着整个项目所有使用该 table 组件都需要遵守这个返回结果定义的字段。)
234+
> (需要注意的是,这里的修改是全局性的,意味着整个项目所有使用该 table 组件都需要遵守这个返回结果定义的字段。)
235+
>
236+
> 文档中的结构有可能由于组件 bug 进行修正而改动。实际修改请以当时最新版本为准
235237
236-
修改 `@/components/table/index.js`132 行起
238+
修改 `@/components/table/index.js`156 行起
237239

238240

239241

240242
```javascript
241243
result.then(r => {
242-
this.localPagination = Object.assign({}, this.localPagination, {
243-
current: r.pageNo, // 返回结果中的当前分页数
244-
total: r.totalCount, // 返回结果中的总记录数
245-
showSizeChanger: this.showSizeChanger,
246-
pageSize: (pagination && pagination.pageSize) ||
247-
this.localPagination.pageSize
248-
})
249-
250-
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
251-
if (r.data.length == 0 && this.localPagination.current != 1) {
252-
this.localPagination.current--
253-
this.loadData()
254-
return
255-
}
244+
this.localPagination = this.showPagination && Object.assign({}, this.localPagination, {
245+
current: r.pageNo, // 返回结果中的当前分页数
246+
total: r.totalCount, // 返回结果中的总记录数
247+
showSizeChanger: this.showSizeChanger,
248+
pageSize: (pagination && pagination.pageSize) ||
249+
this.localPagination.pageSize
250+
}) || false
251+
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
252+
if (r.data.length === 0 && this.showPagination && this.localPagination.current > 1) {
253+
this.localPagination.current--
254+
this.loadData()
255+
return
256+
}
256257

257-
// 这里用于判断接口是否有返回 r.totalCount 或 this.showPagination = false
258-
// 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
259-
!r.totalCount && ['auto', false].includes(this.showPagination) && (this.localPagination = false)
260-
this.localDataSource = r.data // 返回结果中的数组数据
261-
this.localLoading = false
262-
});
258+
// 这里用于判断接口是否有返回 r.totalCount 且 this.showPagination = true 且 pageNo 和 pageSize 存在 且 totalCount 小于等于 pageNo * pageSize 的大小
259+
// 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
260+
try {
261+
if ((['auto', true].includes(this.showPagination) && r.totalCount <= (r.pageNo * this.localPagination.pageSize))) {
262+
this.localPagination.hideOnSinglePage = true
263+
}
264+
} catch (e) {
265+
this.localPagination = false
266+
}
267+
console.log('loadData -> this.localPagination', this.localPagination)
268+
this.localDataSource = r.data // 返回结果中的数组数据
269+
this.localLoading = false
270+
})
263271
```
264272
返回 JSON 例子:
265273
```json
@@ -330,4 +338,4 @@ result.then(r => {
330338
更新时间
331339
----
332340

333-
该文档最后更新于: 2019-01-21 AM 08:37
341+
该文档最后更新于: 2019-06-23 PM 17:19

src/router/README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
| title | 路由标题, 用于显示面包屑, 页面标题 *推荐设置 | string | - |
5353
| icon | 路由在 menu 上显示的图标 | [string,svg] | - |
5454
| keepAlive | 缓存该路由 | boolean | false |
55-
| hidden | 配合`alwaysShow`使用,用于隐藏菜单时,提供递归到父菜单显示 选中菜单项_(可参考 个人页 配置方式)_ | boolean | false |
55+
| hidden | 配合`hideChildrenInMenu`使用,用于隐藏菜单时,提供递归到父菜单显示 选中菜单项_(可参考 个人页 配置方式)_ | boolean | false |
5656
| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com./sendya/ant-design-pro-vue/blob/master/src/components/layout/PageHeader.vue#L14) 组件中的页面带的 面包屑和页面标题栏 | boolean | false |
5757
| permission | 与项目提供的权限拦截匹配的权限,如果不匹配,则会被禁止访问该路由页面 | array | [] |
5858

@@ -72,7 +72,7 @@ const asyncRouterMap = [
7272
children: [
7373
{
7474
path: '/dashboard',
75-
component: Layout,
75+
component: RouteView,
7676
name: 'dashboard',
7777
redirect: '/dashboard/workplace',
7878
meta: {title: '仪表盘', icon: 'dashboard', permission: ['dashboard']},
@@ -131,10 +131,15 @@ const asyncRouterMap = [
131131

132132
> 1. 请注意 `component: () => import('..') ` 方式引入路由的页面组件为 懒加载模式。具体可以看 [Vue 官方文档](https://router.vuejs.org/zh/guide/advanced/lazy-loading.html)
133133
> 2. 增加新的路由应该增加在 '/' (index) 路由的 `children`
134-
> 3. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com./sendya/ant-design-pro-vue/blob/master/src/store/modules/permission.js#L10)
134+
> 3. 子路由的父级路由必须有 `router-view` 才能让子路由渲染出来,请仔细查阅 vue-router 文档
135+
> 4. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com./sendya/ant-design-pro-vue/blob/master/src/store/modules/permission.js#L10)
135136
136137

137138

138139
附权限路由结构:
139140

140-
![权限结构](https://static-2.loacg.com/open/static/github/permissions.png)
141+
![权限结构](https://static-2.loacg.com/open/static/github/permissions.png)
142+
143+
144+
145+
第二种前端路由由后端动态生成的设计,可以前往官网文档 https://pro.loacg.com/docs/authority-management 参考

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -11087,10 +11087,10 @@ webpack-sources@^1.1.0, webpack-sources@^1.3.0:
1108711087
source-list-map "^2.0.0"
1108811088
source-map "~0.6.1"
1108911089

11090-
webpack-theme-color-replacer@^1.1.5:
11091-
version "1.1.5"
11092-
resolved "https://registry.npmjs.org/webpack-theme-color-replacer/-/webpack-theme-color-replacer-1.1.5.tgz#b2659220341e55bedc6eee3eebeec0be56b7995e"
11093-
integrity sha512-D3VQC387qKOrZz2/SMc7+rRxbioT56+SwVhZOkucDfun86ByXCwrfNfhlN+SiufHJp/rDQUL9f27gKa+00Xvgw==
11090+
webpack-theme-color-replacer@^1.2.15:
11091+
version "1.2.15"
11092+
resolved "https://registry.yarnpkg.com/webpack-theme-color-replacer/-/webpack-theme-color-replacer-1.2.15.tgz#f42ab038974d8a6ee85a074b65de0cfc17c9f472"
11093+
integrity sha512-tht5fk6ce6ZwXqPbvkLBJMS+iAM3H60pyexKvZHEbkHpQ1Onq2Y0u6+wUbNBQ/QfDEvCTX5MSkNfD2w/ZJEeKg==
1109411094

1109511095
"webpack@>=4 < 4.29":
1109611096
version "4.28.4"

0 commit comments

Comments
 (0)