Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.

Commit 35abaac

Browse files
authored
Merge pull request #300 from huzhengen/native
docs: src/guide/migration/v-on-native-modifier-removed.md
2 parents fcdb208 + a53b358 commit 35abaac

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
---
2-
title: v-on.native modifier removed
2+
title: 移除 v-on.native 修饰符
33
badges:
44
- breaking
55
---
66

7-
<!-- TODO: translation -->
7+
# 移除 `v-on.native` 修饰符 <MigrationBadges :badges="$frontmatter.badges" />
88

9-
# `v-on.native` modifier removed <MigrationBadges :badges="$frontmatter.badges" />
9+
## 概览
1010

11-
## Overview
11+
`v-on``.native` 修饰符已被移除。
1212

13-
The `.native` modifier for `v-on` has been removed.
13+
## 2.x 语法
1414

15-
## 2.x Syntax
16-
17-
Event listeners passed to a component with `v-on` are by default only triggered by emitting an event with `this.$emit`. To add a native DOM listener to the child component's root element instead, the `.native` modifier can be used:
15+
默认情况下,传递给带有 `v-on` 的组件的事件监听器只有通过 `this.$emit` 才能触发。要将原生 DOM 监听器添加到子组件的根元素中,可以使用 `.native` 修饰符:
1816

1917
```html
2018
<my-component
@@ -23,11 +21,11 @@ Event listeners passed to a component with `v-on` are by default only triggered
2321
/>
2422
```
2523

26-
## 3.x Syntax
24+
## 3.x 语法
2725

28-
The `.native` modifier for `v-on` has been removed. At the same time, the [new `emits` option](./emits-option.md) allows the child to define which events it does indeed emit.
26+
`v-on` `.native` 修饰符已被移除。同时,[新增的 `emits` 选项](./emits-option.md)允许子组件定义真正会被触发的事件。
2927

30-
Consequently, Vue will now add all event listeners that are _not_ defined as component-emitted events in the child as native event listeners to the child's root element (unless `inheritAttrs: false` has been set in the child's options).
28+
因此,对于子组件中**被定义为组件触发的所有事件监听器,Vue 现在将把它们作为原生事件监听器添加到子组件的根元素中 (除非在子组件的选项中设置了 `inheritAttrs: false`)。
3129

3230
```html
3331
<my-component
@@ -46,14 +44,14 @@ Consequently, Vue will now add all event listeners that are _not_ defined as com
4644
</script>
4745
```
4846

49-
## Migration Strategy
47+
## 迁移策略
5048

51-
- remove all instances of the `.native` modifier.
52-
- ensure that all your components document their events with the `emits` option.
49+
- 删除 `.native` 修饰符的所有实例。
50+
- 确保所有组件都使用 `emits` 选项记录其事件。
5351

54-
## See also
52+
## 参考
5553

56-
- [Relevant RFC](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0031-attr-fallthrough.md#v-on-listener-fallthrough)
57-
- [Migration guide - New Emits Option](./emits-option.md)
58-
- [Migration guide - `$listeners` removed](./listeners-removed.md)
59-
- [Migration guide - Changes in the Render Functions API](./render-function-api.md)
54+
- [相关的 RFC](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0031-attr-fallthrough.md#v-on-listener-fallthrough)
55+
- [迁移指南 - 新增 Emits 选项](./emits-option.md)
56+
- [迁移指南 - 移除 `$listeners`](./listeners-removed.md)
57+
- [迁移指南 - 渲染函数 API 的更改](./render-function-api.md)

0 commit comments

Comments
 (0)