el-table中如何排序?

clipboard.png

在el-table-column中加入了sortable,但是如何在label中显示出三个这样的排序呢?

相关代码

    <el-table-column prop="deviceGroupName"sortable :sort-by="['abnormalDevice','onlineDevice', 'totalDevice']"
                     label="设备(异常/在线/总数)"
                     width="300">
                     <template slot-scope="scope">
                         {{ scope.row.abnormalDevice }}/{{ scope.row.onlineDevice }}/{{ scope.row.totalDevice }}
                     </template>
    </el-table-column>

如何能做出像图片这样的效果呢?

阅读 4.8k
1 个回答

你这个应该不好用el-table自带的那个排序了,要自己搞了
字后面跟两个图标,然后点击的时候判断active然后请求后台列表接口
template用slot=header,element要在2.4.11以上,或者用render-header

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题