File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ var validation = new Vue({
367
367
368
368
### 组件的自定义事件
369
369
370
- ` prop ` 是父传子,子船父通过 ` $emit() `
370
+ ` prop ` 是父传子,子传父通过 ` $emit() `
371
371
372
372
``` html
373
373
<div id =" emit" >
@@ -486,7 +486,7 @@ var nameSlot = new Vue({
486
486
487
487
``` html
488
488
<div >
489
- <!-- <slot name="slotname"></slot> = <p slot="slotname">具名插槽</h1 >-->
489
+ <!-- <slot name="slotname"></slot> = <p slot="slotname">具名插槽</p >-->
490
490
<p >具名插槽</p >
491
491
<h1 >Tom</h1 >
492
492
<!-- 其它没有 slot 属性的子元素将全部分发到 <slot></slot> 标签 -->
@@ -496,3 +496,5 @@ var nameSlot = new Vue({
496
496
```
497
497
498
498
### 作用域插槽
499
+
500
+ 作用域插槽是一种特殊类型的插槽,用作一个 (能被传递数据的) 可重用模板,来代替已经渲染好的元素。在子组件中,只需将数据传递到插槽,就像你将 prop 传递给组件一样:
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ <h1>php</h1>
82
82
< p slot ="slotname "> 具名插槽</ p >
83
83
</ child >
84
84
</ div >
85
+
86
+ <!-- slot插槽 - 作用域插槽 -->
85
87
</ body >
86
88
</ html >
87
89
< script src ="https://cdn.bootcdn.net/ajax/libs/vue/2.6.1/vue.js "> </ script >
@@ -313,4 +315,6 @@ <h1>Tom</h1>
313
315
} ,
314
316
} ,
315
317
} ) ;
318
+
319
+ // slot插槽 - 作用域插槽
316
320
</ script >
You can’t perform that action at this time.
0 commit comments