Skip to content

Commit

Permalink
docs: 增加faq章节
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldshen authored and levy9527 committed Jun 24, 2019
1 parent e4c95ad commit c25e5b3
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 16 deletions.
7 changes: 3 additions & 4 deletions docs/before-confirm.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
提交前的操作
自定义新增、修改请求前的操作

```vue
<template>
Expand Down Expand Up @@ -36,15 +36,13 @@ export default {
}
}
],
formAttrs: {labelWidth: '80px'},
url: 'https://api.github.com/search/users?q=FEMessage',
dataPath: 'items',
totalPath: 'total_count',
columns: [
{prop: 'id', label: 'id'},
{prop: 'login', label: '名称'},
{prop: 'type', label: '账户类型'},
{prop: 'html_url', label: '主页地址'}
],
beforeConfirm(data, isNew) {
if (isNew) {
Expand All @@ -54,7 +52,8 @@ export default {
alert('修改不可以发送请求')
return Promise.reject()
}
}
},
hasDelete: false
}
},
}
Expand Down
1 change: 0 additions & 1 deletion docs/before-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
$id: 'name',
label: '用户名',
$el: {placeholder: '请输入用户名'}
// rules: [{required: true, trigger: 'blur', whitespace: true}]
}
],
beforeSearch: () => {
Expand Down
1 change: 0 additions & 1 deletion docs/can-search-collapse.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
$id: 'name',
label: '用户名',
$el: {placeholder: '请输入用户名'}
// rules: [{required: true, trigger: 'blur', whitespace: true}]
}
],
canSearchCollapse: true
Expand Down
84 changes: 84 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
## 获取组件内的el-table实例

```html
<el-data-table
ref="dataTable"
v-bind="tableConfig"
></el-data-table>
```

```javascript
this.$refs.dataTable.$refs.table
```


## 手动调用el-data-table刷新

```javascript
this.$refs.dataTable.getList()
```

## 查询后刷新

### 场景
![](https://cdn.nlark.com/yuque/0/2018/png/160590/1543571549979-6e8e9121-538d-47f6-a319-3f3941d2f3e0.png#align=left&display=inline&height=406&originHeight=406&originWidth=1344&status=done&width=747)<br />![](https://cdn.nlark.com/yuque/0/2018/png/160590/1543571651982-1aaffcbf-ad2e-471f-948b-d18de3c5c73c.png#align=left&display=inline&height=432&originHeight=432&originWidth=1298&status=done&width=747)

### 解决方案
把select option的value变成字符串类型

### 原有代码

```javascript
searchForm: [
{
$el: {placeholder: '请选择'},
label: '状态',
$id: 'status',
$type: 'select',
$options: [
{
value: 1,
label: '待处理'
},
]
}
],
```


### 改动后代码

```javascript
searchForm: [
{
$el: {placeholder: '请选择'},
label: '状态',
$id: 'status',
$type: 'select',
$options: [
{
value: '1', // 修改了这一行
label: '待处理'
},
]
}
],
```

## 弹窗关闭时清空选中状态


### 场景
el-data-table 在 el-dialog 中展示,在 el-dialog 关闭后,清空 el-data-table 的选中状态。


### 解决方案
![](https://cdn.nlark.com/yuque/0/2018/png/160590/1544089655978-f73452e4-8da6-476e-8dbd-22a975e9a89c.png#align=left&display=inline&height=632&originHeight=632&originWidth=1700&status=done&width=827)

```javascript
cancelRelation() {
this.showRelationDialog = false
this.selected = []
this.$refs.outsideModuleTable.$refs.table.clearSelection()
}
```
18 changes: 8 additions & 10 deletions styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ const {VueLoaderPlugin} = require('vue-loader')
const path = require('path')
const glob = require('glob')

const demos = glob.sync('docs/!(basic).md')
const demoSections = [
{
name: 'basic',
content: 'docs/basic.md'
}
].concat(
demos.map(filePath => ({
const demos = ['docs/basic.md', ...glob.sync('docs/!(basic|faq).md')].map(
filePath => ({
name: path.basename(filePath, '.md'),
content: filePath
}))
})
)

module.exports = {
Expand All @@ -34,7 +28,11 @@ module.exports = {
},
{
name: 'Demo',
sections: demoSections
sections: demos
},
{
name: 'FAQ',
content: 'docs/faq.md'
}
],
webpackConfig: {
Expand Down

0 comments on commit c25e5b3

Please sign in to comment.