iview button disabled usable or unusable depending on conditions

I. Features:

When the data is empty, unavailable button, when the data is not empty, the button is available.

Second, the code to achieve:

<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;
    },
  },

 

Guess you like

Origin www.cnblogs.com/wangyuxue/p/11307969.html