Element-ui Radio不能自动选中

用Element-ui,单选框死活无法自动选中。console.log打印出来值是正确的,最后还用了toString()才解决。最后一查发现是label没加冒号 :

总结:

:label=“1”,表示label的值为数字1,即期待数据值为数字
label=“1”,表示label的值为字符串1,即期待的数据值为字符串1

用 label

<el-radio-group v-model="recordData.assertType">
	<el-radio label = "0">使用手动断言</el-radio>
	<el-radio label = "1">使用录制结果断言</el-radio>
</el-radio-group>

对应string

 this.recordData.assertType = '1'

用 :label

<el-radio-group v-model="recordData.assertType">
	<el-radio :label = "0">使用手动断言</el-radio>
	<el-radio :label = "1">使用录制结果断言</el-radio>
</el-radio-group>

对应数字

 this.recordData.assertType = 1
发布了11 篇原创文章 · 获赞 1 · 访问量 2159

猜你喜欢

转载自blog.csdn.net/zhanghe_zht/article/details/103460148