首发于 前端攻城狮
Vue.之. 动态设置按钮Disabled

Vue.之. 动态设置按钮Disabled

按钮代码如下:

添加了一个 属性 :disabled="isAble" ,控制:更新按钮、重置按钮

<el-form-item>
  <el-button type="primary" :disabled="isAble" @click="operateFormSubmit()" plain> 更 新 </el-button>
  <el-button :disabled="isAble" @click="operateFormSubmitReset('operateForm')" > 重 置 </el-button>
  <el-button type="success" @click="operateFormAppend()" plain> 追加 </el-button>
</el-form-item>


在Vue的代码中,如下:

           operateFormRemoveDomain(item) {
                let domains = this.operateForm.domains
                let _len = domains['length'] - 1
                if (_len == 0) {
                    this.isAble = true; 
                } else {
                    this.isAble = false;