Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select 选择器 showSearch 和 dropdownRender 一起使用时,在自定义内容上添加事件,无法触发 #644

Closed
1 task
724493602 opened this issue Mar 27, 2019 · 16 comments
Labels

Comments

@724493602
Copy link

724493602 commented Mar 27, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.3.5

Environment

windows,chrome

Reproduction link

https://codesandbox.io/embed/3yor9yw00p

Steps to reproduce

<a-select showSearch v-decorator="['name',{rules: [{ required: true, message: '请选择管理员!' }]}]" placeholder="请选择管理员">
<div slot="dropdownRender" slot-scope="menu" >
<div style="padding: 8px; cursor: pointer;" @click="fn">
<a-icon type="plus" /> <span>增加管理员</span>
</div>
<a-divider style="margin: 4px 0;" />
<v-nodes :vnodes="menu"/>
</div>
<a-select-option v-for="item in roles" :key="item.user_id" :value="item.user_id">{{ item.real_name }}</a-select-option>
</a-select>

What is expected?

fn 函数能触发

What is actually happening?

fn 点击无反应


去掉showSearch参数就正常触发

@wangxueliang
Copy link
Member

请提供复现链接(https://codesandbox.io/s/2wpk21kzvr) 方便排查 谢谢

@724493602
Copy link
Author

https://codesandbox.io/embed/3yor9yw00p
已提供复现链接

@tangjinzhou
Copy link
Member

@724493602
你在确认下?你提供的复现链接并不能复现你描述的问题
image

@724493602
Copy link
Author

兼容性问题吗?在windows上确实是没反应,在我同事mac上点击触发了,chrome版本73

@lin19950219
Copy link

windows上我是用@mousedown来触发的,@click好像会有冲突

@Xbantian
Copy link

@724493602 于是,你是怎么解决问题的呢,你的测试链接我能回弹,但是我的demo以及官网demo不行

image

环境:
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.38 Safari/537.36

@tangjinzhou
Copy link
Member

@Xbantian 没有showSearch时 回弹有问题 但是事件触发我这边没能复现

@hn4930
Copy link

hn4930 commented May 25, 2019

@这个是windows上面才会出现的问题 @tangjinzhou 在windows环境下存在showSearch时无法触发插槽的click事件

@hn4930
Copy link

hn4930 commented May 25, 2019

@hn4930
Copy link

hn4930 commented May 25, 2019

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36

@ChimingPhang
Copy link

同上,showSearch的时候无法触发插槽的click事件,请问修复了吗

@lk8888
Copy link

lk8888 commented Sep 10, 2019

这个问题还没修复吗

@tangjinzhou
Copy link
Member

添加 @mousedown="{e => e.preventDefault()}"
ref ant-design/ant-design#13448

@janpun
Copy link

janpun commented Oct 15, 2019

添加 @mousedown="{e => e.preventDefault()}"
ref ant-design/ant-design#13448

你的这个我测试了不行,应该是加上
@mousedown="e => e.preventDefault()"

@nongzhenli
Copy link

请问下自定义拓展的 select dropdownRender
VNodes: { functional: true, render: (h, ctx) => { return ctx.props.vnodes } },
该内容中,我如何自定义事件呢?

需求是,mode='tags'时,
1、回车将输入内容添加之前触发事件,请求接口对比是否已经存在该值
2、点击tag删除前,触发回调事件是否允许删除

我看了 antd React 版本的有提供 tagRender 属性,实现自定义tag的,因为真的很需要这个功能、后续考虑加进去吗?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

10 participants