Commit ecc3fe764c3f7ae130865f9bb756c419c3707266
1 parent
ceb7d4a1
Exists in
master
and in
1 other branch
支持全局配置关键词别名
Showing
2 changed files
with
11 additions
and
2 deletions
Show diff stats
packages/index.js
| ... | ... | @@ -57,6 +57,15 @@ const install = function (Vue, opts = {}) { |
| 57 | 57 | if (component.methods) { |
| 58 | 58 | component.methods.i18n = opts.i18n || emptyMethod; |
| 59 | 59 | if (component.name.indexOf('Scheme') > -1) { |
| 60 | + if (opts.currPageAlias) { | |
| 61 | + component.computed.currPageAlias = () => opts.currPageAlias; | |
| 62 | + } | |
| 63 | + if (opts.pageSizeAlias) { | |
| 64 | + component.computed.pageSizeAlias = () => opts.pageSizeAlias; | |
| 65 | + } | |
| 66 | + if (opts.totalCountAlias) { | |
| 67 | + component.computed.totalCountAlias = () => opts.totalCountAlias; | |
| 68 | + } | |
| 60 | 69 | if (opts.searchFilter) { |
| 61 | 70 | component.methods.searchFilter = opts.searchFilter; |
| 62 | 71 | } | ... | ... |
packages/scheme/index.vue
| ... | ... | @@ -442,7 +442,7 @@ export default { |
| 442 | 442 | if (isReset) { |
| 443 | 443 | this.currentPage = 1; |
| 444 | 444 | } |
| 445 | - const { currPageAlias = 'currPage', pageSizeAlias = 'pageSize' } = this.option || {}; | |
| 445 | + const { currPageAlias = this.currPageAlias || 'currPage', pageSizeAlias = this.pageSizeAlias || 'pageSize' } = this.option || {}; | |
| 446 | 446 | const fixedParams = this.option.params || {}; |
| 447 | 447 | const param = { |
| 448 | 448 | ...this.searchModel, |
| ... | ... | @@ -455,7 +455,7 @@ export default { |
| 455 | 455 | }, |
| 456 | 456 | // 查询数据逻辑 |
| 457 | 457 | async doSearch(param) { |
| 458 | - const { totalCountAlias = 'totalCount' } = this.option || {}; | |
| 458 | + const { totalCountAlias = this.totalCountAlias || 'totalCount' } = this.option || {}; | |
| 459 | 459 | if (this.option.searchAPI) { // 配置了自定义查询API的情况 |
| 460 | 460 | this.tableLoading = true; |
| 461 | 461 | try { | ... | ... |