We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sortByAsc 方法中 this.currentColumns[index]._sortType = 'asc' sortByDesc 方法中 this.currentColumns[index]._sortType = 'desc' 上面两处的写法,点击排序时候不会触发 render 函数重新渲染 参考 Vue 官方文档:https://cn.vuejs.org/v2/guide/list.html#数组更新检测 代码修改如下 sortByAsc (key) { let field = this.currentColumns[key].key this.currentColumns = this.currentColumns.map((col, index) => Object.assign(col, { _sortType: index == key ? 'asc' : 'normal' })) this.currentData.sort((a, b) => a[field] > b[field] ? 1 : -1) }, sortByDesc (key) { let field = this.currentColumns[key].key this.currentColumns = this.currentColumns.map((col, index) => Object.assign(col, { _sortType: index == key ? 'desc' : 'normal' })) this.currentData.sort((a, b) => a[field] < b[field] ? 1 : -1) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
sortByAsc 方法中
this.currentColumns[index]._sortType = 'asc'
sortByDesc 方法中
this.currentColumns[index]._sortType = 'desc'
上面两处的写法,点击排序时候不会触发 render 函数重新渲染
参考 Vue 官方文档:https://cn.vuejs.org/v2/guide/list.html#数组更新检测
代码修改如下
sortByAsc (key) {
let field = this.currentColumns[key].key
this.currentColumns = this.currentColumns.map((col, index) => Object.assign(col, { _sortType: index == key ? 'asc' : 'normal' }))
this.currentData.sort((a, b) => a[field] > b[field] ? 1 : -1)
},
sortByDesc (key) {
let field = this.currentColumns[key].key
this.currentColumns = this.currentColumns.map((col, index) => Object.assign(col, { _sortType: index == key ? 'desc' : 'normal' }))
this.currentData.sort((a, b) => a[field] < b[field] ? 1 : -1)
}
The text was updated successfully, but these errors were encountered: