vue事件修饰符.passive
时间: 2023-12-17 21:04:37 浏览: 119
在Vue中,事件修饰符`.passive`用于告诉浏览器,你不想阻止事件的默认行为。这与普通的`preventDefault`方法不同。`preventDefault`会完全阻止事件的默认行为,而`.passive`只是告诉浏览器你不想阻止默认行为,但并不会主动去阻止它。这在一些特定场景下非常有用,例如滚动事件的监听,当你需要监听滚动事件但不想阻止页面的滚动时,可以使用`.passive`修饰符。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [vue中的事件修饰符.self、.capture和.passive](https://blog.csdn.net/xiaolinlife/article/details/107013723)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [vue 事件修饰符 .passive 最通俗的理解](https://blog.csdn.net/chunxiaqiudong5/article/details/126083075)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文