vue-seamless-scroll点击失效
时间: 2023-08-16 09:08:54 浏览: 103
解决vue组件中click事件失效的问题
5星 · 资源好评率100%
在使用vue-seamless-scroll包裹一个滚动div的list时,如果发现点击事件没有效果,原因是因为vue-seamless-scroll中间包裹的dom复制渲染,没有带上dom的事件。\[1\]为了解决这个问题,可以使用事件委托的方式。在vue-seamless-scroll外部的div上添加点击事件,并通过$event.target获取点击的对象。\[2\]\[3\]这样就可以处理点击事件了。
#### 引用[.reference_title]
- *1* *3* [vue-seamless-scroll插件点击事件无效???](https://blog.csdn.net/m0_70547044/article/details/128375879)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [vue-seamless-scroll插件使用后点击事件无效](https://blog.csdn.net/weixin_40121676/article/details/122959584)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文