@@ -50,9 +50,9 @@ test('layout default slot', () => {
50
50
})
51
51
```
52
52
53
- ## 命名插槽
53
+ ## 具名插槽
54
54
55
- 你可能有一个更复杂的 ` <layout> ` 组件,带有一些命名插槽 。例如:
55
+ 你可能有一个更复杂的 ` <layout> ` 组件,带有一些具名插槽 。例如:
56
56
57
57
``` js
58
58
const Layout = {
@@ -73,7 +73,7 @@ const Layout = {
73
73
}
74
74
```
75
75
76
- VTU 也支持这一点 。你可以编写如下测试。在这个示例中,我们将 HTML 而不是文本内容传递给插槽
76
+ VTU 同样支持这种用法 。你可以编写如下测试。在这个示例中,我们将 HTML 而不是文本内容传递给插槽
77
77
78
78
``` js
79
79
test (' layout full page layout' , () => {
@@ -132,11 +132,11 @@ test('layout full page layout', () => {
132
132
})
133
133
```
134
134
135
- [ 参考测试 ] ( https://github.com/vuejs/test-utils/blob/9d3c2a6526f3d8751d29b2f9112ad2a3332bbf52/tests/mountingOptions/slots.spec.ts#L124-L167 ) 获取更多示例和用例 。
135
+ [ 参考这些测试 ] ( https://github.com/vuejs/test-utils/blob/9d3c2a6526f3d8751d29b2f9112ad2a3332bbf52/tests/mountingOptions/slots.spec.ts#L124-L167 ) 以获取更多示例和用例 。
136
136
137
137
## 作用域插槽
138
138
139
- [ 作用域插槽] ( https://v3 .vuejs.org/guide/component- slots.html#scoped-slots ) 和绑定也得到了支持 。
139
+ 我们也支持 [ 作用域插槽] ( https://cn .vuejs.org/guide/components/ slots.html#scoped-slots ) 及其绑定 。
140
140
141
141
``` js
142
142
const ComponentWithSlots = {
@@ -172,7 +172,7 @@ test('scoped slots', () => {
172
172
test (' scoped slots' , () => {
173
173
const wrapper = mount (ComponentWithSlots, {
174
174
slots: {
175
- scoped: ` Hello {{ params.msg }}` // no wrapping template tag provided, slot scope exposed as " params"
175
+ scoped: ` Hello {{ params.msg }}` // 没有包装 template 标签时,插槽作用域暴露为“ params”
176
176
}
177
177
})
178
178
@@ -182,7 +182,7 @@ test('scoped slots', () => {
182
182
183
183
## 结论
184
184
185
- - 使用 ` slots ` 挂载选项来测试组件使用 ` <slot> ` 是否正确渲染内容 。
185
+ - 使用 ` slots ` 挂载选项来测试使用 ` <slot> ` 的组件是否正确渲染内容 。
186
186
- 内容可以是字符串、渲染函数或导入的单文件组件 (SFC)。
187
- - 使用 ` default ` 表示默认插槽,使用正确的名称表示命名插槽 。
188
- - 作用域插槽和 ` # ` 简写也得到了支持 。
187
+ - 对于默认插槽使用 ` default ` ,对于具名插槽使用对应的名称 。
188
+ - 支持作用域插槽和 ` # ` 简写 。
0 commit comments