Skip to content

Commit fd31749

Browse files
docs(zh-cn): guide/advanced/slots.md (#2565)
* slots.md * Apply suggestions from code review * Update docs/zh/guide/advanced/slots.md --------- Co-authored-by: Jinjiang <[email protected]>
1 parent 627f719 commit fd31749

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/zh/guide/advanced/slots.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ test('layout default slot', () => {
5050
})
5151
```
5252

53-
## 命名插槽
53+
## 具名插槽
5454

55-
你可能有一个更复杂的 `<layout>` 组件,带有一些命名插槽。例如:
55+
你可能有一个更复杂的 `<layout>` 组件,带有一些具名插槽。例如:
5656

5757
```js
5858
const Layout = {
@@ -73,7 +73,7 @@ const Layout = {
7373
}
7474
```
7575

76-
VTU 也支持这一点。你可以编写如下测试。在这个示例中,我们将 HTML 而不是文本内容传递给插槽
76+
VTU 同样支持这种用法。你可以编写如下测试。在这个示例中,我们将 HTML 而不是文本内容传递给插槽
7777

7878
```js
7979
test('layout full page layout', () => {
@@ -132,11 +132,11 @@ test('layout full page layout', () => {
132132
})
133133
```
134134

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)以获取更多示例和用例
136136

137137
## 作用域插槽
138138

139-
[作用域插槽](https://v3.vuejs.org/guide/component-slots.html#scoped-slots)和绑定也得到了支持
139+
我们也支持[作用域插槽](https://cn.vuejs.org/guide/components/slots.html#scoped-slots)及其绑定
140140

141141
```js
142142
const ComponentWithSlots = {
@@ -172,7 +172,7 @@ test('scoped slots', () => {
172172
test('scoped slots', () => {
173173
const wrapper = mount(ComponentWithSlots, {
174174
slots: {
175-
scoped: `Hello {{ params.msg }}` // no wrapping template tag provided, slot scope exposed as "params"
175+
scoped: `Hello {{ params.msg }}` // 没有包装 template 标签时,插槽作用域暴露为“params
176176
}
177177
})
178178

@@ -182,7 +182,7 @@ test('scoped slots', () => {
182182

183183
## 结论
184184

185-
- 使用 `slots` 挂载选项来测试组件使用 `<slot>` 是否正确渲染内容
185+
- 使用 `slots` 挂载选项来测试使用 `<slot>` 的组件是否正确渲染内容
186186
- 内容可以是字符串、渲染函数或导入的单文件组件 (SFC)。
187-
- 使用 `default` 表示默认插槽,使用正确的名称表示命名插槽
188-
- 作用域插槽和 `#` 简写也得到了支持
187+
- 对于默认插槽使用 `default`,对于具名插槽使用对应的名称
188+
- 支持作用域插槽和 `#` 简写

0 commit comments

Comments
 (0)