17定义局部过滤器

<el-tag :type="scope.row.hxTag | formatType">{{
  scope.row.hxTag
}}</el-tag>


filters: {
  formatType(value) {
    const tags = [
      { text: "单质", type: "" },
      { text: "氧化物", type: "success" },
      { text: "酸", type: "info" },
      { text: "碱", type: "warning" },
      { text: "盐", type: "danger" }
    ];
    return tags.find(e => e.text == value).type;
  }
}

 

posted on 2020-06-15 21:53  章画  阅读(158)  评论(0编辑  收藏  举报

导航