Vue.之. 動態設置按鈕Disabled


Vue.之. 動態設置按鈕Disabled

  

 按鈕代碼如下:

  添加了一個 屬性      :disabled="isAble"  ,控制:更新按鈕、重置按鈕

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

 

在Vue的代碼中,如下:

operateFormRemovedomain 是一個方法。主要代碼是:this.isAble = true 這個控制上面按鈕可用不可用.

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM