You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2022. It is now read-only.
The `.native` modifier for `v-on` has been removed.
13
+
## 2.x 语法
14
14
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` 修饰符:
18
16
19
17
```html
20
18
<my-component
@@ -23,11 +21,11 @@ Event listeners passed to a component with `v-on` are by default only triggered
23
21
/>
24
22
```
25
23
26
-
## 3.x Syntax
24
+
## 3.x 语法
27
25
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.
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).
0 commit comments