后端返回的字段为null转字符串“”

119 阅读1分钟
queryStudentLeaveList(params).then(res =>{
					if(res.data.success){
						that.messagesList = res.data.result
						for(let o of that.messagesList){
							if(!o.reason){
								o.reason = ''
							}
						}
					}
					

使用 for of 进行遍历,拿到列表的每一项的值,然后直接判断null时,直接转""