用a-select组件之后添加小图标太累了,还是推荐手写select
以下是我的用定位处理的笨办法,后面有空了在手写一个带图标的select组件
直接上代码:
HTML
<a-form-item name='organization' class="selectOrg">
<HomeOutlined style="color:rgba(0,0,0,.25)"/>
<a-select v-model="loginForm.organization" placeholder="请选择单位">
<a-select-option v-for="(org,index) in orgs" :key="index" :value="org">{{org}}</a-select-option>
</a-select>
</a-form-item>
CSS
.ant-col{
margin: auto;
position: relative;
#organization{
position: absolute;
left: 10px;
top: calc(50% - 5px);
z-index: 1000;
}
}
ps:我也不知道为什么图标的容器上会给我带一个organization的的id,
而且把容器放在a-select内会报错
效果如下: