ElementUI-Table表头排序ElementUI - Table 表头⾃带排序功能,和排序事件,但是⽬前只是对当前界⾯的数据进⾏排序。项⽬需求:点击表头排序的时候,对所有数据进⾏排序。
初步⽅案:在点击排序按钮的时,在排序事件sort-change 中,进⾏数据请求,
此时会先重拍⼀次当前页⾯的数据,再渲染接⼝返回数据。⽤户体验不是很好。
优化⽅案:使⽤render-header⾃定义tableHeader,此时要使⽤render函数来创建表头。getheaderTime(h) {
const This = this
return h('div', {
},
['告警时间',
h('span', {
class: 'iline-table-sort'
},
[
h('i', {
'class': {
'el-icon-caret-bottom': derByType === 'desc',
'el-icon-caret-top': derByType === 'asc',
'active': derBy === 'daqTime'
},
elementui登录界面attrs: {
'orderByType': 'desc',
'orderType': 'daqTime'
},
on: {
click: This.clickHandler
},
style: {
fontSize: '22px'
}
})
]
)
])
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。