el-select多选不换行
时间: 2023-08-24 08:15:16 浏览: 224
回答: 要实现el-select多选不换行的效果,你可以在el-select标签中加上class="selects",然后在style中添加以下样式代码:
```css
.selects .el-select__tags {
display: flex;
flex-wrap: nowrap;
}
.selects .el-select__tags-text {
max-width: 80px;
display: inline-block;
overflow: hidden;
vertical-align: bottom;
text-overflow: ellipsis;
}
```
这样设置之后,多选的选项将会在同一行显示,并且超出最大宽度的选项会显示省略号。\[1\]\[3\]如果你想使用官方提供的代码,可以直接使用以下代码:
```html
<el-select v-model="value2" multiple collapse-tags style="margin-left: 20px;" placeholder="请选择" class="selects">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
```
这样也可以实现多选不换行的效果。\[2\]
#### 引用[.reference_title]
- *1* *2* [【element】el-select多选撑开原输入框高度并换行](https://blog.csdn.net/Weiqian_/article/details/130107339)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [el-select 多选 添加collapse-tags之后换行问题](https://blog.csdn.net/weixin_53558474/article/details/126577918)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文