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">使用结果0</el-radio>
	<el-radio label = "1">使用结果1</el-radio>
</el-radio-group>

对应string

 this.recordData.assertType = '1'

用 :label

<el-radio-group v-model="recordData.assertType">
	<el-radio :label = "0">使用结果0</el-radio>
	<el-radio :label = "1">使用结果1</el-radio>
</el-radio-group>

对应数字

 this.recordData.assertType = 1

版权声明:本文为zhanghe_zht原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。