Skip to content

Commit 31b1b6f

Browse files
committed
chore(dev): v-if + emit in mounted
1 parent e0adb21 commit 31b1b6f

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

packages/shell-dev-vue3/src/App.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import EventNesting from './EventNesting.vue'
77
import AsyncComponent from './AsyncComponent.vue'
88
import SuspenseExample from './SuspenseExample.vue'
99
import Provide from './Provide.vue'
10+
import Condition from './Condition.vue'
1011
1112
export default {
1213
name: 'MyApp',
@@ -19,7 +20,8 @@ export default {
1920
EventNesting,
2021
AsyncComponent,
2122
SuspenseExample,
22-
Provide
23+
Provide,
24+
Condition
2325
}
2426
}
2527
</script>
@@ -34,6 +36,7 @@ export default {
3436
<AsyncComponent />
3537
<SuspenseExample />
3638
<Provide />
39+
<Condition />
3740

3841
<nav>
3942
<router-link to="/p1">
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script>
2+
export default {
3+
components: {
4+
InIf: {
5+
name: 'InIf',
6+
mounted () {
7+
this.$emit('hi')
8+
},
9+
template: '<div>Inside v-if</div>'
10+
}
11+
},
12+
13+
data () {
14+
return {
15+
show: true
16+
}
17+
}
18+
}
19+
</script>
20+
21+
<template>
22+
<div>
23+
<button @click="show = !show">
24+
Toggle
25+
</button>
26+
<InIf v-if="show" />
27+
</div>
28+
</template>

0 commit comments

Comments
 (0)