Vue中computed的传值问题

1,098 阅读1分钟
  computed: {
    //唯一渠道数据过虑
    findname(data) {
      return function(data) {
        for (let index = 0; index < this.allqudao.length; index++) {
          if (data == this.allqudao[index].apiway) {
            return "唯一[" + this.allqudao[index].apiname + "]";
          } else {
            return "无";
          }
        }
      };
    }
  },

查询资料得知。利用闭包的写法

 <template v-if="scope.row.probtype == 0">{{findname(scope.row.apiway) }}</template>