This repository was archived by the owner on Aug 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
# 插槽
2
2
3
- > 该页面假设你已经阅读过了[ 组件基础] ( component-basics.md ) 。如果你还对组件不太了解 ,推荐你先阅读它。
3
+ > 该页面假设你已经阅读过了[ 组件基础] ( component-basics.md ) 。如果你对组件还不太了解 ,推荐你先阅读它。
4
4
5
5
## 插槽内容
6
6
@@ -96,17 +96,17 @@ Vue 实现了一套内容分发的 API,这套 API 的设计灵感源自 [Web C
96
96
97
97
> 父级模板里的所有内容都是在父级作用域中编译的;子模板里的所有内容都是在子作用域中编译的。
98
98
99
- ## 后备内容
99
+ ## 备用内容
100
100
101
- 有时为一个插槽设置具体的后备 (也就是默认的) 内容是很有用的,它只会在没有提供内容的时候被渲染。例如在一个 ` <submit-button> ` 组件中:
101
+ 有时为一个插槽设置具体的备用 (也就是默认的) 内容是很有用的,它只会在没有提供内容的时候被渲染。例如在一个 ` <submit-button> ` 组件中:
102
102
103
103
``` html
104
104
<button type =" submit" >
105
105
<slot ></slot >
106
106
</button >
107
107
```
108
108
109
- 我们可能希望这个 ` <button> ` 内绝大多数情况下都渲染文本“Submit”。为了将“Submit”作为后备内容 ,我们可以将它放在 ` <slot> ` 标签内:
109
+ 我们可能希望这个 ` <button> ` 内绝大多数情况下都渲染文本“Submit”。为了将“Submit”作为备用内容 ,我们可以将它放在 ` <slot> ` 标签内:
110
110
111
111
``` html
112
112
<button type =" submit" >
@@ -120,7 +120,7 @@ Vue 实现了一套内容分发的 API,这套 API 的设计灵感源自 [Web C
120
120
<submit-button ></submit-button >
121
121
```
122
122
123
- 后备内容 “Submit”将会被渲染:
123
+ 备用内容 “Submit”将会被渲染:
124
124
125
125
``` html
126
126
<button type =" submit" >
@@ -136,7 +136,7 @@ Vue 实现了一套内容分发的 API,这套 API 的设计灵感源自 [Web C
136
136
</submit-button >
137
137
```
138
138
139
- 则这个提供的内容将会被渲染从而取代后备内容 :
139
+ 则这个提供的内容将会被渲染从而取代备用内容 :
140
140
141
141
``` html
142
142
<button type =" submit" >
@@ -243,7 +243,7 @@ app.component('todo-list', {
243
243
})
244
244
```
245
245
246
- 我们可能需要替换插槽以在父组件上自定义它 :
246
+ 我们可能需要替换插槽使它作用在父组件上 :
247
247
248
248
``` html
249
249
<todo-list >
@@ -356,7 +356,7 @@ function (slotProps) {
356
356
</todo-list >
357
357
```
358
358
359
- 你甚至可以定义后备内容 ,用于插槽 prop 是 undefined 的情形:
359
+ 你甚至可以定义备用内容 ,用于插槽 prop 是 undefined 的情形:
360
360
361
361
``` html
362
362
<todo-list v-slot =" { item = 'Placeholder' }" >
You can’t perform that action at this time.
0 commit comments