Skip to content

Commit 535e997

Browse files
github-actions[bot]muronggwebfansplz
authored
feat(question): prevent event propagation
Co-authored-by: 木荣 <[email protected]> Co-authored-by: webfansplz <[email protected]>
1 parent c13f3b6 commit 535e997

File tree

5 files changed

+96
-0
lines changed

5 files changed

+96
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script setup lang="ts">
2+
3+
const click1 = () => {
4+
console.log('click1')
5+
}
6+
7+
const click2 = () => {
8+
console.log('click2')
9+
}
10+
11+
</script>
12+
13+
<template>
14+
<div @click="click1()">
15+
<div @click="click2()">
16+
click me
17+
</div>
18+
</div>
19+
</template>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--info-header-start-->
2+
<!--info-header-end-->
3+
4+
5+
In this challenge,you should make the click event's propagation to be stopped,let's go 👇:
6+
7+
8+
```vue
9+
<script setup lang="ts">
10+
11+
const click1 = () => {
12+
console.log('click1')
13+
}
14+
15+
const click2 = () => {
16+
console.log('click2')
17+
}
18+
19+
</script>
20+
21+
<template>
22+
<div @click="click1()">
23+
<div @click="click2()">
24+
click me
25+
</div>
26+
</div>
27+
</template>
28+
```
29+
30+
31+
<!--info-footer-start-->
32+
<!--info-footer-end-->
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--info-header-start-->
2+
<!--info-header-end-->
3+
4+
5+
在这个挑战中,你需要阻点击事件的冒泡,让我们开始吧。
6+
7+
```vue
8+
<script setup lang="ts">
9+
10+
const click1 = () => {
11+
console.log('click1')
12+
}
13+
14+
const click2 = () => {
15+
console.log('click2')
16+
}
17+
18+
</script>
19+
20+
<template>
21+
<div @click="click1()">
22+
<div @click="click2()">
23+
click me
24+
</div>
25+
</div>
26+
</template>
27+
```
28+
29+
30+
<!--info-footer-start-->
31+
<!--info-footer-end-->
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
difficulty: easy
2+
title: prevent event propagation
3+
tags: Event Handling
4+
author:
5+
github: murongg
6+
name: 木荣
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
difficulty: easy
2+
title: 阻止事件冒泡
3+
tags: Event Handling
4+
author:
5+
github: murongg
6+
name: 木荣
7+

0 commit comments

Comments
 (0)