Skip to content

Commit 3a11810

Browse files
Jinjiangeddyerburgh
authored andcommitted
docs(zh-cn): synced recent updates to #195449e (#291)
1 parent 94648c6 commit 3a11810

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

docs/zh-cn/api/options.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,10 @@ expect(wrapper.find('div')).toBe(true)
6363
#### 传递文本
6464

6565
你可以传递文本到 `slots`
66-
这里有两处限制
66+
这里有一处限制
6767

68-
这只在 Vue 2.2+ 及以上版本工作。
69-
70-
下面的这段代码的文本可以工作。
71-
72-
```js
73-
const wrapper = mount(ComponentWithSlots, { slots: { default: 'foobar' }})
74-
```
75-
76-
下面的这段代码的文本则不可以工作。
77-
78-
```js
79-
const wrapper1 = mount(ComponentWithSlots, { slots: { default: 'foo<span>bar</span>' }})
80-
const wrapper2 = mount(FooComponent, { slots: { default: 'foo {{ bar }}' }})
81-
```
68+
我们不支持 PhantomJS。
69+
请使用 [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer)
8270

8371
### `stubs`
8472

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- **属性:**
66

7+
`wrappers` `array`: 包含在 `WrapperArray` 内的 `Wrappers`
78
`length` `number`:该 `WrapperArray` 中包含的 `Wrapper` 的数量。
89

910
- **方法:**

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,17 @@ wrapper.trigger('click', {
2929

3030
expect(clickHandler.called).toBe(true)
3131
```
32+
33+
- **设置事件目标:**
34+
35+
在这背后,`trigger` 创建了一个 `Event` 对象并分发到其包裹器的元素上。
36+
37+
我们没有机会编辑 `Event` 对象的 `target` 值,所以你无法在选项对象中设置 `target`
38+
39+
如果想在 `target` 中添加一个特性,你需要在调用 `trigger` 之前设置包裹器元素的那个值。你可以通过 `element` 属性做到这件事。
40+
41+
```js
42+
const input = wrapper.find('input')
43+
input.element.value = 100
44+
input.trigger('click')
45+
```

docs/zh-cn/guides/dom-events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ wrapper.find('button').trigger('click')
2222

2323
`trigger` 方法接受一个可选的 `options` 对象。这个 `options` 对象里的属性会被添加到事件中。
2424

25+
注意其目标不能被添加到 `options` 对象中。
2526

2627
```js
2728
const wrapper = mount(MyButton)

0 commit comments

Comments
 (0)