antd design vue中select组件多选maxTagTextLength属性不生效

项目中使用的版本是:"ant-design-vue": "2.2.8"
给它设置个最大宽度试试看 max-width: 170px;

<template>
	...
	<Select
      v-model:value="selectValue"
       mode="multiple"
       :maxTagCount="1" // 最多显示多少个 tag
       :maxTagTextLength="2" // 最大显示的 tag 文本长度(不生效。。。)
       placeholder="请选择"
       allow-clear
     >
       <SelectOption
         v-for="item in selectOptions"
         :key="item.id"
         :value="item.name"
         >{{ item.name }}</SelectOption
       >
     </Select>
	...
</template>

<script setup lang="ts">
	import { ref } from 'vue';

	const selectValue = ref('');
	const selectOptions = ref([
		{ id: '01', name: '好多字好多字好多字1' },
		{ id: '02', name: '好多字好多字好多字2' },
		{ id: '03', name: '好多字好多字好多字3' },
		...
	])
</script> 

<style scoped lang="scss">
	  :deep(.ant-select-selection-item-content) {
	    max-width: 170px; // 设置最大宽度
	  }
</style>
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值