代码复现如下
<e-select v-model="selectionVal">
<e-option :value="item.value"
v-for="item in optionList"
:key="item.value">
{{item.lable}}
</e-option>
</e-select>
接口返回的selectionVal值为null,则会报错,为空值或undefined则不会报错。
所以接收到接口的值时必须进行判断:
if(!selectionVal) {
//如果为null或者undefined,!null和!undefined返回true,如果有值,则返回false
selectionVal = ''
}