当前位置:网站首页>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.
(完)
边栏推荐
猜你喜欢
随机推荐
STM32-遥感数据处理
SAP SD module foreground operation
持续投入商品研发,叮咚买菜赢在了供应链投入上
第13章 网络安全漏洞防护技术原理与应用
Continuing to pour money into commodities research and development, the ding-dong buy vegetables in win into the supply chain
Kubernetes:(十一)KubeSphere的介绍和安装(华丽的篇章)
计算首屏时间
在Activity中获取另一个XML文件的控件
Flink jdbc connector 源码改造sink之 clickhouse多节点轮询写与性能分析
Flask Framework Beginner-05-Command Management Manager and Database Use
Example 040: Reverse List
实例041:类的方法与变量
2022焊工(初级)上岗证题目模拟考试平台操作
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
持续投入商品研发,叮咚买菜赢在了供应链投入上
Taurus.MVC WebAPI 入门开发教程1:框架下载环境配置与运行(含系列目录)。
工程制图名词解释-重点知识
【原创】启动Win10自带的XPS/OXPS阅读器
可变字符串
TensoFlow学习记录(二):基础操作