File tree Expand file tree Collapse file tree 4 files changed +129
-54
lines changed Expand file tree Collapse file tree 4 files changed +129
-54
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <p class =" demo" >
3
+ <passing-props
4
+ title =" This is from <passing-props />"
5
+ childPropA =" This is from <passing-props-child />"
6
+ @click =" handleClickPassingPropsChildComponent"
7
+ >
8
+ </passing-props >
9
+ </p >
10
+ </template >
11
+
12
+ <script >
13
+ import PassingProps from ' ./PassingProps' ;
14
+
15
+ export default {
16
+ components: {
17
+ PassingProps,
18
+ },
19
+ methods: {
20
+ handleClickPassingPropsChildComponent () {
21
+ console .log (' This event comes from `<passing-props-child />`' );
22
+ alert (' This event comes from `<passing-props-child />`' );
23
+ },
24
+ },
25
+ };
26
+ </script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <h1 >{{title}}</h1 >
4
+ <passing-props-child v-bind =" $attrs" v-on =" $listeners" ></passing-props-child >
5
+ </div >
6
+ </template >
7
+
8
+ <script >
9
+ import PassingPropsChild from ' ./PassingPropsChild' ;
10
+
11
+ export default {
12
+ components: {
13
+ PassingPropsChild,
14
+ },
15
+ inheritAttrs: false ,
16
+ props: {
17
+ title: {
18
+ type: String ,
19
+ default: ' Hello, Vue!' ,
20
+ },
21
+ },
22
+ };
23
+ </script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <button class =" btn btn-primary" @click =" $emit('click')" >{{childPropA}}</button >
3
+ </template >
4
+
5
+ <script >
6
+ export default {
7
+ props: {
8
+ childPropA: String ,
9
+ },
10
+ };
11
+ </script >
You can’t perform that action at this time.
0 commit comments