網站首頁 編程語言 正文
- 最近在做項目表單部分,會遇到表單數據沒有雙向綁定,或者雙向綁定延遲。
- 直接看代碼,在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
相關推薦
- 2022-10-29 Android 開發 | API 指南- Content Provider 應用程序的使用方法
- 2023-10-14 c/c++--__attribute__ 機制
- 2022-04-14 淺談Go切片的值修改是否會覆蓋數組的值?_Golang
- 2022-06-07 victoriaMetrics代理性能優化問題解析_數據庫其它
- 2021-12-05 C++11?關鍵字?const?使用小結_C 語言
- 2022-09-17 詳解React?如何防止?XSS?攻擊論$$typeof?的作用_React
- 2022-09-26 go使用makefile腳本編譯應用的方法小結_Golang
- 2022-10-01 Python函數參數基礎介紹及示例_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支