当前位置:网站首页>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.
(完)
边栏推荐
- flinkcdc 消费 mysql binlog 没有 sqltype=delete 的数据是什么原
- mpf5_定价Bond_yield curve_Spot coupon_duration_有效利率_连续复利_远期_Vasicek短期_CIR模型Derivatives_Tridiagonal_ppf
- 2022年茶艺师(中级)考试试题模拟考试平台操作
- 持续投入商品研发,叮咚买菜赢在了供应链投入上
- 实例036:算素数
- Zabbix设置邮件告警+企业微信告警
- 工程制图平面投影练习
- Download install and create/run project for HBuilderX
- Promise solves blocking synchronization and turns asynchronous into synchronous
- Example 041: Methods and variables of a class
猜你喜欢

Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment

Day13 Postman的使用

实例041:类的方法与变量

Flask Framework Beginner-06-Add, Delete, Modify and Check the Database

Kubernetes:(九)coredns(浪不动了)

IDEA02:配置SQL Server2019数据库

关联接口测试

TensoFlow学习记录(二):基础操作

2022 China Computing Power Conference released the excellent results of "Innovation Pioneer"

Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
随机推荐
[QNX Hypervisor 2.2用户手册]10.3 vdev gic
html select标签赋值数据库查询结果
LeetCode:899. 有序队列【思维题】
Multithreading JUC Learning Chapter 1 Steps to Create Multithreading
大佬们,读取mysql300万单表要很长时间,有什么参数可以优惠,或者有什么办法可以快点
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
计算首屏时间
KunlunBase 1.0 is released!
Download install and create/run project for HBuilderX
HBuilderX的下载安装和创建/运行项目
STM32-遥感数据处理
【原创】启动Win10自带的XPS/OXPS阅读器
5. Scrapy middleware & distributed crawler
- heavy OpenCV 】 【 mapping
C# 构造函数业务场景测试项目
实例038:矩阵对角线之和
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
小甲鱼汇编笔记
MySQL高级-读写分离-分库分表
initramfs详解----添加硬盘驱动并访问磁盘