Commit ecc3fe764c3f7ae130865f9bb756c419c3707266

Authored by Aaron
1 parent ceb7d4a1
Exists in master and in 1 other branch legacy

支持全局配置关键词别名

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,6 +57,15 @@ const install = function (Vue, opts = {}) {
57 if (component.methods) { 57 if (component.methods) {
58 component.methods.i18n = opts.i18n || emptyMethod; 58 component.methods.i18n = opts.i18n || emptyMethod;
59 if (component.name.indexOf('Scheme') > -1) { 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 if (opts.searchFilter) { 69 if (opts.searchFilter) {
61 component.methods.searchFilter = opts.searchFilter; 70 component.methods.searchFilter = opts.searchFilter;
62 } 71 }
packages/scheme/index.vue
@@ -442,7 +442,7 @@ export default { @@ -442,7 +442,7 @@ export default {
442 if (isReset) { 442 if (isReset) {
443 this.currentPage = 1; 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 const fixedParams = this.option.params || {}; 446 const fixedParams = this.option.params || {};
447 const param = { 447 const param = {
448 ...this.searchModel, 448 ...this.searchModel,
@@ -455,7 +455,7 @@ export default { @@ -455,7 +455,7 @@ export default {
455 }, 455 },
456 // 查询数据逻辑 456 // 查询数据逻辑
457 async doSearch(param) { 457 async doSearch(param) {
458 - const { totalCountAlias = 'totalCount' } = this.option || {}; 458 + const { totalCountAlias = this.totalCountAlias || 'totalCount' } = this.option || {};
459 if (this.option.searchAPI) { // 配置了自定义查询API的情况 459 if (this.option.searchAPI) { // 配置了自定义查询API的情况
460 this.tableLoading = true; 460 this.tableLoading = true;
461 try { 461 try {