当前位置:网站首页>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.
(完)
边栏推荐
猜你喜欢
随机推荐
MallBook 助力SKT思珂特教育集团,立足变化,拥抱敏捷交易
在更一般意义上验算移位距离和假设
Use of lombok annotation @RequiredArgsConstructor
持续投入商品研发,叮咚买菜赢在了供应链投入上
计算首屏时间
How to copy baby from Taobao (or Tmall store) through API interface to Pinduoduo interface code docking tutorial
Apache DolphinScheduler actual combat task scheduling platform - a new generation of distributed workflow
共n级台阶,每次可以上1级或2级台阶,有多少种上法?
安全至上:落地DevSecOps最佳实践你不得不知道的工具
实例038:矩阵对角线之和
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
持续投入商品研发,叮咚买菜赢在了供应链投入上
Web APIs BOM- 操作浏览器:swiper 插件
JS 从零教你手写节流throttle
STM32-遥感数据处理
天地图坐标系转高德坐标系 WGS84转GCJ02
实例035:设置输出颜色
SAP SD module foreground operation
KunlunBase 1.0 is released!
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.