Skip to content

Commit

Permalink
fix: removed events-as-props
Browse files Browse the repository at this point in the history
  • Loading branch information
NataliaTepluhina authored and Jinjiang committed Jan 9, 2024
1 parent 02f9d13 commit d25c789
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/guide/components/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,3 @@ export default {
```

</div>

## 将事件作为 prop {#events-props}

你也可以通过在大写的事件名称前加上 `on``events` 作为 `props` 声明并传递。

与使用 `emit('event')` 的行为不同,`props.onEvent` 只会处理基于属性的监听器 (`@event``:on-event`)。

:::warning
如果同时传递了 `:onEvent``@event`,则 `props.onEvent` 可能是一个函数数组而不是单个函数,这种行为不稳定,可能会在未来改变。
:::

因此,建议在触发事件时使用 `emit('event')` 而不是 `props.onEvent`

0 comments on commit d25c789

Please sign in to comment.