大概要做成这样 废话不说直接贴代码
<el-select v-model="queryParams.supplier" placeholder="供应商" clearable>
<el-option v-for="(item, index) in gongyingshang" :key="item.value" :label="item.label"
:value="item.value">
{{ item.label }}
<!-- 将 label 改为插槽形式 -->
<template>
<el-popconfirm confirmButtonText="好的" cancelButtonText="取消" icon="el-icon-info" iconColor="red"
title="确定删除该供应商吗?" @confirm="deleteOptiongongyingshang(index)">
<span class="delete-option" slot="reference">删除</span>
</el-popconfirm>
</template>
</el-option>
<template>
<div class="add" @click="add()">
<span style="font-size: 16px">+</span> 新增
</div>
</template>
</el-select>
还有css 把新增框固定在下
.add {
width: 100%;
height: 30px;
color: #3396fa;
text-align: center;
border-top: 1px solid #ccc;
font-size: 14px;
line-height: 30px;
position: sticky;
bottom: 0px;
background-color: #fff;
opacity: 1;
}
有个小问题 就是 select框拉到最下的时候 最后一个option会增大高度 这边懒得写 有朋友优化了记得告诉我贴下代码谢谢