程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长


+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

table 自定义排序

发布于2022-01-06 23:23     阅读(456)     评论(0)     点赞(8)     收藏(2)


  1. <Table
  2. border
  3. ref="selection"
  4. :loading="table.loading"
  5. stripe
  6. :columns="table.columns"
  7. @on-sort-change="sortdata" //调用
  8. v-if="!table.update"
  9. :data="table.data"
  10. :height="table.height"
  11. >
  12. </Table>
  13. table: {
  14. data: [],
  15. update: false,
  16. loading: false,
  17. height: null,
  18. columns: [
  19. {
  20. align: 'center',
  21. title:'序号',
  22. width: 60,
  23. render:(h,params)=>{
  24. return h('span',params.index+1+(this.pagination.p-1)*this.pagination.s);
  25. }
  26. },
  27. {
  28. title: '名称',
  29. align: "center",
  30. minWidth: 180,
  31. tooltip: true,
  32. key: 'fName', //需要排序对象
  33. sortable: 'custom', //需要排序正序和倒序
  34. }]
  35. }
  36. //排序
  37. sortdata:function(column,key,order){
  38. let _this = this;
  39. _this.pagination.orderStr = '';
  40. _this.pagination.orderType = '';
  41. _this.pagination.orderStr = column.key;
  42. if (column.order === 'asc') { //升序
  43. _this.pagination.orderType = column.order;
  44. } else {
  45. _this.pagination.orderType = column.order;
  46. }
  47. _this.research(false)
  48. },

原文链接:https://blog.csdn.net/sinat_24713805/article/details/122318406




所属网站分类: 技术文章 > 博客

作者:西门费雪

链接:http://www.qianduanheidong.com/blog/article/284432/2423f5a4b46ecfa32b4a/

来源:前端黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

8 0
收藏该文
已收藏

评论内容:(最多支持255个字符)