在antd 中写select组件
如下所示
<div class="label">所属学校</div>
<a-select
v-decorator="[
item.transName,
{
rules: [
{ required: true, message: item.fieldName + '不能为空' },
]
}
]"
v-model="college"
mode="multiple"
:maxTagCount="2"
autocomplete="off"
style="width: 252px;margin-top:10px;margin-right: 28px"
:getPopupContainer="triggerNode => triggerNode.parentNode"
@change="handleCollegeChange"
@blur="getRoleData"
@popupScroll="onScroll"
@search="handleSearch"
>
<a-select-option
v-for="item in collegeList"
:key="item.id"
:value="item.name"
:disabled="college.length >= 5 && college.findIndex(o => o === item.name) === -1"
>
{{ item.name }}
</a-select-option>
</a-select>
出现报错
以上错误时因为,v-model, v-decorator,@change 三者同时存在造成的,任意去掉一个报错消失,即可进行下拉多选了。