事件修饰符 阻止冒泡 .stop 阻止默认事件 .prevent
stop修饰符
阻止冒泡行为
可以在函数中利用$event传参通过stopPropagation()阻止冒泡

通过直接在元素中的指令中添加 .stop

prevent修饰符
阻止默认行为
可以在函数中利用$event传参通过preventDefault()阻止默认行为

通过直接在元素中的指令中添加 .prevent

其他的事件修饰符
.stop.prevent.capture.self.once.passive
事件修饰符可以串联使用,串联的顺序不一样,所表示的意思也不同
例如 .prevent.selt 表示阻止所有默认事件
.self.prevent表示只阻止自身默认事件

浙公网安备 33010602011771号