Detailed vue in the event modifier (stop, prevent, self, once, capture, passive)

==. Stop == is to prevent bubbling behavior, not to continue the current event element out triggers, such as clicking div prevent internal event, event trigger div
==. Prevent == behavior is to prevent the event itself, such as to prevent a hyperlink click to jump, form the form and click Submit
==. Self == is triggered only own their own will be implemented, if the received signal transmission inside the bubbling event is triggered, it will ignore the signal
==. Capture == js change the default event mechanism, the default is bubbling, capture function is changed to listen to the bubbling mode
==. Once == event is set once, when the second shot acts as the event itself will perform only once, such as .click.prevent.once representatives only prevent event's default behavior
==. passive == scroll event of default behavior (ie scroll behavior) will trigger immediately, without waiting for onScrollcompletion. This can improve the performance of particular modifier .passive mobile terminal.

.passive and .prevent not be used together:

  • .prevent will be ignored

.self and .stop difference:

  • self only respond to events triggered by the current element itself, it will not trigger a response after the event bubbling, and will not stop bubbling continue to trigger to the outside.
  • stop itself starts from the bubbling to the outside is not emitted signal

I feel a small partner to help point a praise ~

Guess you like

Origin www.cnblogs.com/zheroXH/p/11578719.html