fix(advance table): fix 默认 onChnage prop 为null bug

This commit is contained in:
glenn 2019-08-21 11:17:04 +08:00
parent 49ff956af2
commit efe7e790e8
3 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"name": "naive-ui",
"version": "0.2.109",
"version": "0.2.110",
"description": "",
"main": "index.js",
"scripts": {

View File

@ -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,7 +451,8 @@ export default {
ref.setSort(sorter.type)
// this.sortIndexs[sorter.key] = sorter.type
}
filter && Object.keys(filter).forEach((key) => {
filter &&
Object.keys(filter).forEach((key) => {
const ref = this.$refs['filterDropDown_' + key][0]
ref.setCheckedIndexs(filter[key])
})
@ -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)
})
}

View File

@ -39,10 +39,12 @@ const funcToPromise = (fn, receiver) => {
})
}
}
const noopFn = () => {}
export {
getScrollParent,
deepClone,
getObjValue,
funcToPromise
funcToPromise,
noopFn
}