当前位置:网站首页>Ant - the design of the Select component using a custom icon (suffixIcon attribute) suffixes, click on the custom ICONS have no reaction, will not display the drop-down menu
Ant - the design of the Select component using a custom icon (suffixIcon attribute) suffixes, click on the custom ICONS have no reaction, will not display the drop-down menu
2022-08-04 02:09:00 【Frost and snow away】
一. 问题原因
custom icons are usedant-design的Icon图标组件
我是在ant-design-reactThis problem occurs in the project of ,估计ant-design-vue中也会这样.
import {
CaretDownOutlined } from '@ant-design/icons'
import {
Select } from 'antd'
<Select
size='large'
showArrow
bordered={
false}
value={
selTransactionType}
options={
transactionOptions}
onChange={
handleTransactionTypeChange}
suffixIcon={
<CaretDownOutlined style={
{
fontSize: '15px', color: '#CBD0DB' }} />}
/>

点击SelectAll other sections can display drop-down boxes,Only clicking on the icon does not respond.
二. 解决办法
让UIThe students cut the arrow out,Put it in the form of a label
import {
CaretDownOutlined } from '@ant-design/icons'
import {
Select, Image } from 'antd'
<Select
size='large'
showArrow
bordered={
false}
value={
selTransactionType}
options={
transactionOptions}
onChange={
handleTransactionTypeChange}
suffixIcon={
<Image
src={
'https://XXXXXXXXXX/date-icon.png'}
alt='coverImage'
preview={
false}
style={
{
width: '16px', height: '16px' }}
/>
<img
src={
'https://XXXXXXXXXX/date-icon.png'}
alt='coverImage'
style={
{
width: '16px', height: '16px' }}
/>
}
/>
若是使用ant-design的Image组件,ant-design的ImageThe component comes with a preview image function,记得需要将preview置为false.
或者直接用img标签即可.

The dropdown box can now be displayed regardless of whether the icon is clicked or anywhere else.
(完)
边栏推荐
猜你喜欢
随机推荐
Web APIs BOM- 操作浏览器:swiper 插件
splice随机添加和删除的写法
Flask框架初学-05-命令管理Manager及数据库的使用
QNX Hypervisor 2.2用户手册]10.2 vdev 8259
GNSS[0]- Topic
简单的线性表的顺序表示实现,以及线性表的链式表示和实现、带头节点的单向链表,C语言简单实现一些基本功能
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
sql有关问题,小时粒度,找到前一个小时内的数据
Promise solves blocking synchronization and turns asynchronous into synchronous
出海季,互联网出海锦囊之本地化
ssh服务详解
Flink原理流程图简单记录
What is SVN (Subversion)?
安全至上:落地DevSecOps最佳实践你不得不知道的工具
Example 041: Methods and variables of a class
5.scrapy中间件&分布式爬虫
小程序:扫码打开参数解析
Sky map coordinate system to Gaode coordinate system WGS84 to GCJ02
什么是SVN(Subversion)?
Example 037: Sorting









