Skip to content

Commit 8836071

Browse files
Jinjiangeddyerburgh
authored andcommitted
docs(zh-cn): synced recent updates (vuejs#539)
1 parent 9960f7c commit 8836071

File tree

7 files changed

+46
-6
lines changed

7 files changed

+46
-6
lines changed

docs/zh-cn/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。
2323
* [挂载选项](api/options.md)
2424
- [context](api/options.md#context)
2525
- [slots](api/options.md#slots)
26+
- [scopedSlots](api/options.md#scopedslots)
2627
- [stubs](api/options.md#stubs)
2728
- [mocks](api/options.md#mocks)
2829
- [localVue](api/options.md#localvue)

docs/zh-cn/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* [挂载选项](api/options.md)
2020
- [context](api/options.md#context)
2121
- [slots](api/options.md#slots)
22+
- [scopedSlots](api/options.md#scopedslots)
2223
- [stubs](api/options.md#stubs)
2324
- [mocks](api/options.md#mocks)
2425
- [localVue](api/options.md#localvue)

docs/zh-cn/api/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* [挂载选项](./options.md)
88
- [context](./options.md#context)
99
- [slots](./options.md#slots)
10+
- [scopedSlots](api/options.md#scopedslots)
1011
- [stubs](./options.md#stubs)
1112
- [mocks](./options.md#mocks)
1213
- [localVue](./options.md#localvue)

docs/zh-cn/api/options.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- [`context`](#context)
88
- [`slots`](#slots)
9+
- [scopedSlots](#scopedslots)
910
- [`stubs`](#stubs)
1011
- [`mocks`](#mocks)
1112
- [`localVue`](#localvue)
@@ -66,7 +67,34 @@ expect(wrapper.find('div')).toBe(true)
6667
这里有一处限制。
6768

6869
我们不支持 PhantomJS。
69-
请使用 [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer)
70+
你可以使用 [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer) 作为替代品。
71+
72+
### `scopedSlots`
73+
74+
- 类型:`{ [name: string]: string }`
75+
76+
提供一个该组件所有带作用域的插槽内容的对象。每个键对应到插槽的名字,每个值可以是一个模板字符串。
77+
78+
There are three limitations.
79+
这里有三处限制。
80+
81+
* 该选项只支持 [email protected]+。
82+
83+
* 你不能在 `scopedSlots` 选项中将 `<template>` 标签用作其根元素。
84+
85+
* 我们不支持 PhantomJS。
86+
你可以使用 [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer) 作为替代品。
87+
88+
示例:
89+
90+
```js
91+
const wrapper = shallow(Component, {
92+
scopedSlots: {
93+
foo: '<p slot-scope="props">{{props.index}},{{props.text}}</p>'
94+
}
95+
})
96+
expect(wrapper.find('#fooWrapper').html()).toBe('<div id="fooWrapper"><p>0,text1</p><p>1,text2</p><p>2,text3</p></div>')
97+
```
7098

7199
### `stubs`
72100

docs/zh-cn/api/wrapper-array/trigger.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# `trigger(eventName)`
1+
# `trigger(eventType [, options ])`
22

33
`WrapperArray` 的每个 `Wrapper` DOM 节点都触发一个事件。
44

55
**注意:该包裹器必须包含一个 Vue 示例。**
66

77
- **参数:**
8-
- `{string} eventName`
8+
- `{string} eventType` **必填**
9+
- `{Object} options` **可选**
910

1011
- **示例:**
1112

docs/zh-cn/api/wrapper/find.md

+8
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,18 @@ import Foo from './Foo.vue'
1717
import Bar from './Bar.vue'
1818

1919
const wrapper = mount(Foo)
20+
2021
const div = wrapper.find('div')
2122
expect(div.is('div')).toBe(true)
23+
2224
const bar = wrapper.find(Bar)
2325
expect(bar.is(Bar)).toBe(true)
26+
27+
const barByName = wrapper.find({ name: 'bar' })
28+
expect(barByName.is(Bar)).toBe(true)
29+
30+
const fooRef = wrapper.find({ ref: 'foo' })
31+
expect(fooRef.is(Foo)).toBe(true)
2432
```
2533

2634
- **延伸阅读:**[Wrapper](README.md)

docs/zh-cn/api/wrapper/trigger.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# `trigger(eventName)`
1+
# `trigger(eventType [, options ])`
22

33
在该 `Wrapper` DOM 节点上触发一个事件。
44

55
`trigger` 带有一个可选的 `options` 对象。`options` 对象内的属性会被添加到事件上。
66

77
- **参数:**
8-
- `{string} eventName`
9-
- `{Object} options`
8+
- `{string} eventType` **必填**
9+
- `{Object} options` **可选**
1010

1111
- **示例:**
1212

0 commit comments

Comments
 (0)