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

mouseout和mouseleave踩了坑 #85

Open
lizhongzhen11 opened this issue Mar 25, 2020 · 0 comments
Open

mouseout和mouseleave踩了坑 #85

lizhongzhen11 opened this issue Mar 25, 2020 · 0 comments

Comments

@lizhongzhen11
Copy link
Owner

最近要搞个外贸网站,找到了 领添,它做的蛮好的,所以当即决定抄它的。

项目用vue-cli4 + ts开发,vue也有好久没用了,发展还蛮快,配合 ts 写法又不同了。

没有引入任何ui库,所以那些样式组件什么的只能自己撸了,自己撸也挺好的,这不,又踩坑了嘛。

我好像就没自己独立写过下拉框组件,我想到了用 mouseovermouseout,结果死活不行,总是有问题,后来试着用 mouseleave 替代 mouseout,果然ok了!

归根结底在于,我用的事件捕获,mouseleave 离开这个包裹着的元素才会触发,但是 mouseout 离开其子元素也会触发,我就说怎么老是执行的,果然开源组件用多了,自己也就慢慢懒散了!

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

1 participant