From efe7e790e8266cea39f66178e597ed1051a1c293 Mon Sep 17 00:00:00 2001 From: glenn Date: Wed, 21 Aug 2019 11:17:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(advance=20table):=20fix=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=20onChnage=20prop=20=E4=B8=BAnull=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- packages/common/AdvanceTable/src/main.vue | 18 +++++++++--------- packages/utils/index.js | 4 +++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index fc692b7aa..918de5bd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "naive-ui", - "version": "0.2.109", + "version": "0.2.110", "description": "", "main": "index.js", "scripts": { diff --git a/packages/common/AdvanceTable/src/main.vue b/packages/common/AdvanceTable/src/main.vue index 8f8345946..8d0b7c844 100644 --- a/packages/common/AdvanceTable/src/main.vue +++ b/packages/common/AdvanceTable/src/main.vue @@ -159,7 +159,7 @@ import SortIcon from '../sortIcon' import filterDropDown from '../filterDropDown' import searchInput from '../searchInput' import Loading from '../loading' - +import { noopFn } from '../../../utils/index' export default { name: 'NAdvanceTable', components: { @@ -201,7 +201,7 @@ export default { }, onChange: { type: Function, - default: null + default: noopFn }, minHeight: { type: [Number, String], @@ -364,7 +364,6 @@ export default { } }, watch: { - currentPage () { if (this.pagination.custom === true) { this.useRemoteChange() @@ -452,10 +451,11 @@ export default { ref.setSort(sorter.type) // this.sortIndexs[sorter.key] = sorter.type } - filter && Object.keys(filter).forEach((key) => { - const ref = this.$refs['filterDropDown_' + key][0] - ref.setCheckedIndexs(filter[key]) - }) + filter && + Object.keys(filter).forEach((key) => { + const ref = this.$refs['filterDropDown_' + key][0] + ref.setCheckedIndexs(filter[key]) + }) searcher && this.$refs.search.setSearch(searcher) if (page) { this.$nextTick(() => { @@ -527,7 +527,7 @@ export default { Object.keys(this.currentFilterColumn).forEach((key) => { const { value, filterFn } = this.currentFilterColumn[key] if (value && filterFn !== 'custom') { - data = data.filter(item => { + data = data.filter((item) => { return filterFn(value, item.row) }) } @@ -536,7 +536,7 @@ export default { // compute search if (this.currentSearchColumn && this.search.onSearch !== 'custom') { const { key, word } = this.currentSearchColumn - data = data.filter(item => { + data = data.filter((item) => { return this.search.onSearch(key, word, item.row) }) } diff --git a/packages/utils/index.js b/packages/utils/index.js index 0045e47a7..3520921f5 100644 --- a/packages/utils/index.js +++ b/packages/utils/index.js @@ -39,10 +39,12 @@ const funcToPromise = (fn, receiver) => { }) } } +const noopFn = () => {} export { getScrollParent, deepClone, getObjValue, - funcToPromise + funcToPromise, + noopFn }