vue el-tag 按钮排序

vue yekong 210℃

vue el-tag 按钮排序

<el-tag
            v-for="(item,index) in typelist"
            :key="item.title" style="margin-left: 20px;margin-bottom: 20px;cursor: pointer;"
            @click="getorder(item)"
            :type="item.type==type && item.order==order?'success':'info'"
            effect="dark">
            {{ item.title }}
          </el-tag>

js

import { caseGetList } from '@/api/user'
import item from '@/views/case/item'

export default {
  data() {
    return {
      list: [],
      pageIndex: 1,
      total: 0,
      keyword: '',
      pageSize: 8,
      type: 0,
      order: 0,
      typelist: [
        { order: 0, title: '时间降序', type: 1 },
        { order: 1, title: '时间升序', type: 1 },
        { order: 0, title: '权重值降序', type: 2 },
        { order: 1, title: '权重值升序', type: 2 }
      ]
    }
  },
  components: { item },
  created() {
  },
  mounted() {
    this.getList()
  },
  methods: {
    getorder(item) {
      this.type = item.type
      this.order = item.order
      this.pageIndex = 1
      this.getList()
    },
    handleCurrentChange(val) {
      this.pageIndex = val
      this.getList()
    },
    getList() {
      let params = {
        pageNum: this.pageIndex,
        pageSize: this.pageSize,
        key: this.keyword,
        order: this.order,
        type: this.type
      }
      var that = this
      caseGetList(params).then(function(res) {
        that.list = res.data.list
        that.total = res.data.total
      })
    }
  }
}
</script>
喜欢 (0)