Hi FE !
Ai
git
前端面试题
前端小tip
  • vite
  • webpack
npm
  • vue2
  • vue3
react
GitHub
Ai
git
前端面试题
前端小tip
  • vite
  • webpack
npm
  • vue2
  • vue3
react
GitHub
  • 表格排序

表格排序

            el-table
              :data="tableData"
              class="y_table"
              border
              stripe
               @sort-change="changeTableSort"
               show-summary
               sum-text="总和"
              style="width: 100%">
                  <el-table-column
                      label="用户数"
                      prop="user_count"
                      :sortable="'custom'"
                      >
                      <template slot-scope="scope">
                          <span>
                              {{scope.row.user_count}}
                          </span>
                      </template>
                  </el-table-column>
            </el-table>
//选择指定列进行排序
changeTableSort(column){
  console.log(column);
  if(column.prop == 'course_title') {
     if(column.order == 'ascending') {
         this.order_type = 1
     } else if(column.order == 'descending') {
         this.order_type = 2
     } else {
         this.order_type = 9
     }
  }
  if(column.prop == 'total_count') {
     if(column.order == 'ascending') {
         this.order_type = 3
     } else if(column.order == 'descending') {
         this.order_type = 4
     } else {
         this.order_type = 9
     }
  }
  if(column.prop == 'valid_count') {
     if(column.order == 'ascending') {
         this.order_type = 5
     } else if(column.order == 'descending') {
         this.order_type = 6
     } else {
         this.order_type = 9
     }
  }
  if(column.prop == 'user_count') {
     if(column.order == 'ascending') {
         this.order_type = 7
     } else if(column.order == 'descending') {
         this.order_type = 8
     } else {
         this.order_type = 9
     }
  }
  this.getData()
},
Edit this page
最近更新: 2025/12/2 01:46
Contributors: qdleader
qdleader
本站总访问量 129823次 | 本站访客数 12人