日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

element form表單數據未雙向綁定

作者:chunchun_H 更新時間: 2022-10-14 編程語言
  • 最近在做項目表單部分,會遇到表單數據沒有雙向綁定,或者雙向綁定延遲。
  • 直接看代碼,在vue組件渲染的時候給表單賦初值。
//data中定義是空對象:serviceDetail:{},
//   初始化
    init(){
        if(this.moduleType == 'module'){
            this.moduleDetail = {
                    name: '',
                    userId:JSON.parse(sessionStorage.getItem('userInfo')).account,
                    remark:'',
                    status:1
            }
        }else{
            this.serviceDetail = {
                name: '',
                userId:JSON.parse(sessionStorage.getItem('userInfo')).account,
                usersId:'',
                remark:'',
                selStatus:'false',
                msgType:'',
                count:'',
                interval:'',
                isSendNight:'',
                isSendImediat:'',
                isSendUnDuty:'0',
                startTime:null,
                endTime:null,
                sendDay:'',
                sendHour:'',
                sendMin:'',
                sendStatus:'1',
                isCycleSend:'',
                cycleStatus:'1',
                cycleMonth:'2',
                cycleDay:'1',
                cycleHour:'1',
                regetData:'0',
                regetAddr:'',
                regetProtocol:'',
                status:2
            }
        }
    },
  • 在頁面切換moduleType值是沒有進行初始化表單,serviceDetail={},在此時拿到表單數據,直接賦值給serviceDetail,里面是找不到任何屬性的,所有頁面數據并未雙向綁定。

原文鏈接:https://blog.csdn.net/organ_sweet/article/details/119993549

欄目分類
最近更新