0
点赞
收藏
分享

微信扫一扫

【Qt 学习笔记】如何在Qt中打印日志 | qDebug的使用 | Assistant的使用

云岭逸人 04-03 06:00 阅读 1

项目场景:

在修改项目bug时,发现后端响应到前端的值,通过@change事件调用方法,在方法中拿到值时,有部分数据丢失。


问题描述

后端传到前端的值为:字符串类型的"00000089",@change调用的方法中,拿到这个值时,变为了89。

错误代码:

<el-from-item prop="insured">
	<el-checkbox-group v-model="dto.insured">
		<% for(item in vo.insured) { %>
			<el-checkbox label="${item.name}" @change = "inChange(${item.no})"> </el-checkbox>
		<% } %>
	</el-checkbox-group >
</el-from-item> 


<script type="text/javascript">
	inChange : function(val){
		console.log("res:" , val);
	}
</script>


原因分析:

后端传到前端的值为:字符串类型的"00000089",但是传递@change事件中,元素类型发生了改变,变为数字类型,传递到方法中就变为了数字类型的89。


解决方案:

直接上代码:

<el-from-item prop="insured">
	<el-checkbox-group v-model="dto.insured">
		<% for(item in vo.insured) { %>
			<el-checkbox label="${item.name}" name="${item.no}" @change = "inChange"> </el-checkbox>
		<% } %>
	</el-checkbox-group >
</el-from-item> 


<script type="text/javascript">
	inChange : function(val, e){
		console.log("res:" , e.target.name);
	}
</script>

举报

相关推荐

0 条评论