背景:
使用Ant-design的Select选择器,实现多选。点击选择框时,选择框不弹出来,并且报错。
报错:
[Vue warn]: Error in render: “Error: Invalid value
of type number
supplied to Option, expected string
when tags/combobox
is true
.”
Error: Invalid value
of type number
supplied to Option, expected string
when tags/combobox
is true
.
原因:
key需要传string,可是我传的是number。
解决办法:
方法1:
:key = “index” 改成 :key = “index + ’ '” //目的是将index从number类型转成String类型
方法2:key换成以字符串的值
结果:
成功显示并选中