亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

vue 2.0 @click.self does not trigger - Stack Overflow
代言
代言 2017-07-05 10:45:02
0
3
1295

vue 2.0 Why is the event not triggered when using @click.self to bind itself?

Scenario:
Mobile terminal development, click on the mask layer to close the pop-up window, but the p box on the mask layer cannot be triggered, that is, the parent is triggered, and the event will not be passed to the child

Vue provides a .self modifier. It has been used before, but it suddenly doesn’t work this time. I don’t know what happened. . .

代言
代言

reply all(3)
過去多啦不再A夢
<!-- 只當事件在該元素本身(而不是子元素)觸發(fā)時觸發(fā)回調(diào) -->
<p v-on:click.self="close" ref="pop">
    <button></button>
</p>

<!--

給組件綁定原生事件

有時候,你可能想在某個組件的根元素上監(jiān)聽一個原生事件??梢允褂?.native 修飾 v-on 

-->

<my-component v-on:click.native.self="close"></my-component>

close(e) {
    console.log(e.target)
    this.$refs.pop.style.display = 'none'
}

伊謝爾倫

Is your p box a sub-component? If it is a sub-component, I guess you need to add @click.native. The official document has it, search it.

迷茫

@click.native.self

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template