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

没有自定义指令有没有简单的办法包装一个自定义的tap事件呢? #303

Open
as3long opened this issue Jun 5, 2018 · 10 comments

Comments

@as3long
Copy link

as3long commented Jun 5, 2018

https://github.com/as3long/san-tap
我尝试包装了一个但是这样会多一个节点出来,有没有更好的建议呢?

@Dafrok
Copy link
Contributor

Dafrok commented Jun 5, 2018

HOC

@as3long
Copy link
Author

as3long commented Jun 5, 2018

高阶组件是可以试试,不过这样就得要求别人一定得把触发tap事件的东西封装成一个组件。我先尝试一下,3Q

@Dafrok
Copy link
Contributor

Dafrok commented Jun 5, 2018

@erik168 显出插件机制的意义了……

@as3long
Copy link
Author

as3long commented Jun 5, 2018

@Dafrok 我刚试了一下,遇到两个问题。

  1. san好像是不支持把子组件当顶级元素
  2. props透传,slot透传的问题

hoc是一个很好的方案,但是解决这个问题好像还有点麻烦

@errorrik
Copy link
Contributor

errorrik commented Jun 5, 2018

@Dafrok 没想好怎么插,哪里能插。

所以这个例子,我在2天内给出答复

@errorrik
Copy link
Contributor

errorrik commented Jun 9, 2018

两天过去了,关于这个问题,我还是一脑袋浆糊

@Dafrok
Copy link
Contributor

Dafrok commented Jun 10, 2018

🤣

@LeuisKen
Copy link
Contributor

LeuisKen commented Jul 3, 2018

这不就是我前段时间想做的事情嘛
https://github.com/LeuisKen/san-touch-tap/blob/master/src/index.js
但是后来和 @jiangjiu 觉得其实也没啥意义,fastclick挺好的,就算了

@Dafrok
Copy link
Contributor

Dafrok commented Jul 3, 2018

上面提到的 prop 透传这一点我觉得还蛮有意义的

@musicode
Copy link

musicode commented Jul 4, 2019

@errorrik 我这有个思路可以关掉这个 issue https://jsrun.net/XCyKp/edit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants