問題總結 elementUI el-checkbox 無法勾選問題


問題場景:

form表單中checkbox的增刪改查,在后台獲取到的數據中拿到checkbox的值,但是改不了狀態,是因為在后台拿到的form表單的數據和重置數據出現沖突

錯誤:

async getDetail () {
      await this.$api.getTaskDetail({
        params: {
          id: this.id
        }
      }).then(res => {
        this.form = res,
        this.form.checkbox = res.email_enbale == '1'? true: false
      })
    },

正確:

async getDetail () {
      await this.$api.getTaskDetail({
        params: {
          id: this.id
        }
      }).then(res => {
        this.form = {
          ...res,
          checkbox: res.email_enbale == '1'? true: false
        }
      })
    },

 


免責聲明!

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



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