iview button根据条件 disabled可用或者不可用

一、功能介绍:

当数据为空时,按钮不可用,当数据不为空时,按钮可用。

二、代码实现:

<span class="expand-value"><Button size="small" :disabled="isdisabledFn" @click="admiss">查看照片</Button></span>
data() {
    return {
      disabled: false,
    };
  },
computed: {
    isdisabledFn() {
      if (this.row.touristimg_url === null || this.row.touristimg_url === '') {
        this.disabled = true;
      } else if (this.row.touristimg_url !== null) {
        this.disabled = false;
      }
      return this.disabled;
    },
  },

猜你喜欢

转载自www.cnblogs.com/wangyuxue/p/11307969.html