`

vue 标签的使用

    博客分类:
  • vue
vue 
阅读更多

  <el-table-column align="header-center" label="状态">
        <template slot-scope="scope">
          <el-tag :type="scope.row.status | statusFilter">
            {{ scope.row.status }}
          </el-tag>
        </template>
      </el-table-column>

map中每种值对应状态框
  filters: {
    statusFilter(status) {
      const statusMap = {
        启用: 'success',
        draft: 'info',
        停用: 'danger'
      }
      return statusMap[status]
    }
  },
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics