Skip to content

Commit

Permalink
truly enter to search
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Oct 14, 2018
1 parent 709bfa5 commit b896616
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/el-data-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!--@slot 额外的搜索内容, 当searchForm不满足需求时可以使用-->
<slot name="search"></slot>
<el-form-item>
<el-button type="primary" @click="getList(1)" size="small">查询</el-button>
<el-button native-type="submit" type="primary" @click="getList(1)" size="small">查询</el-button>
<el-button @click="resetSearch" size="small">重置</el-button>
</el-form-item>
</el-form-renderer>
Expand Down Expand Up @@ -520,19 +520,14 @@ export default {
},
mounted() {
let searchForm = this.$refs.searchForm
let query = history.state || {}
if (searchForm) {
// 阻止表单提交的默认行为, 这在element-ui不会出现, 但在storybook里会出现
searchForm.$el.setAttribute('action', 'javascript:;')
searchForm.$el.addEventListener('submit', e => {
this.getList(1)
})
}
let query = history.state || {}
// 恢复查询条件
// 对slot=search无效
if (searchForm) {
// 恢复查询条件
// 对slot=search无效
Object.keys(query).forEach(k => {
searchForm.updateValue({id: k, value: query[k]})
})
Expand Down

0 comments on commit b896616

Please sign in to comment.