File tree Expand file tree Collapse file tree 6 files changed +32
-7
lines changed Expand file tree Collapse file tree 6 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 221、修复 table 组件 固定左列偶尔无法触发滚动事件的bug
332、优化 table 组件 当有纵向自适应时并设置了最小高度时,表格内容高度小于‘最小高度’则以表格内容高度为准
443、修复 table 组件 数据变化合并单元格样式错乱的问题 #60
5+ 4、table 组件支持通过设置属性` sort-always ` 允许排序只在升序和降序切换 #57
56
672017-12-1
781、修复 table 组件左侧固定列绑定滚动事件失效的问题
Original file line number Diff line number Diff line change @@ -30,7 +30,14 @@ exports.default = {
3030 collection . filter ( function ( column , index ) {
3131
3232 if ( self . enableSort ( column . orderBy ) && column . field === field ) {
33- column . orderBy = column . orderBy === 'asc' ? 'desc' : column . orderBy === 'desc' ? '' : 'asc' ;
33+
34+ if ( self . sortAlways ) {
35+
36+ column . orderBy = column . orderBy === 'asc' ? 'desc' : 'asc' ;
37+ } else {
38+
39+ column . orderBy = column . orderBy === 'asc' ? 'desc' : column . orderBy === 'desc' ? '' : 'asc' ;
40+ }
3441 }
3542
3643 if ( ! self . multipleSort ) {
Original file line number Diff line number Diff line change 431431 type: Boolean ,
432432 default: true
433433 },
434+ // 只在 升序和倒序切换
435+ sortAlways: {
436+ type: Boolean ,
437+ default: false
438+ },
434439 columns: {
435440 type: Array ,
436441 require: true
Original file line number Diff line number Diff line change 11/*
2- * 排序
3- * */
2+ * 排序
3+ * */
44export default {
5- methods :{
5+ methods : {
66 // 是否允许排序
77 enableSort ( val ) {
88 return typeof val === 'string' ? true : false ;
@@ -31,8 +31,15 @@ export default {
3131 collection . filter ( function ( column , index ) {
3232
3333 if ( self . enableSort ( column . orderBy ) && column . field === field ) {
34- column . orderBy = column . orderBy === 'asc' ? 'desc' :
35- ( column . orderBy === 'desc' ? '' : 'asc' ) ;
34+
35+ if ( self . sortAlways ) {
36+
37+ column . orderBy = column . orderBy === 'asc' ? 'desc' : 'asc' ;
38+ } else {
39+
40+ column . orderBy = column . orderBy === 'asc' ? 'desc' :
41+ ( column . orderBy === 'desc' ? '' : 'asc' ) ;
42+ }
3643 }
3744
3845 if ( ! self . multipleSort ) {
Original file line number Diff line number Diff line change 431431 type: Boolean ,
432432 default: true
433433 },
434+ // 只在 升序和倒序切换
435+ sortAlways: {
436+ type: Boolean ,
437+ default: false
438+ },
434439 columns: {
435440 type: Array ,
436441 require: true
You can’t perform that action at this time.
0 commit comments