From ecc3fe764c3f7ae130865f9bb756c419c3707266 Mon Sep 17 00:00:00 2001 From: Aaron <427787340@qq.com> Date: Wed, 4 Dec 2019 17:53:16 +0800 Subject: [PATCH] 支持全局配置关键词别名 --- packages/index.js | 9 +++++++++ packages/scheme/index.vue | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/index.js b/packages/index.js index 44b27b1..be35b61 100644 --- a/packages/index.js +++ b/packages/index.js @@ -57,6 +57,15 @@ const install = function (Vue, opts = {}) { if (component.methods) { component.methods.i18n = opts.i18n || emptyMethod; if (component.name.indexOf('Scheme') > -1) { + if (opts.currPageAlias) { + component.computed.currPageAlias = () => opts.currPageAlias; + } + if (opts.pageSizeAlias) { + component.computed.pageSizeAlias = () => opts.pageSizeAlias; + } + if (opts.totalCountAlias) { + component.computed.totalCountAlias = () => opts.totalCountAlias; + } if (opts.searchFilter) { component.methods.searchFilter = opts.searchFilter; } diff --git a/packages/scheme/index.vue b/packages/scheme/index.vue index 3dcf997..5f5021a 100644 --- a/packages/scheme/index.vue +++ b/packages/scheme/index.vue @@ -442,7 +442,7 @@ export default { if (isReset) { this.currentPage = 1; } - const { currPageAlias = 'currPage', pageSizeAlias = 'pageSize' } = this.option || {}; + const { currPageAlias = this.currPageAlias || 'currPage', pageSizeAlias = this.pageSizeAlias || 'pageSize' } = this.option || {}; const fixedParams = this.option.params || {}; const param = { ...this.searchModel, @@ -455,7 +455,7 @@ export default { }, // 查询数据逻辑 async doSearch(param) { - const { totalCountAlias = 'totalCount' } = this.option || {}; + const { totalCountAlias = this.totalCountAlias || 'totalCount' } = this.option || {}; if (this.option.searchAPI) { // 配置了自定义查询API的情况 this.tableLoading = true; try { -- libgit2 0.21.0