Skip to content

:onChange和@change有什么区别吗?Is there any diffrence between :onChange and @change? #11348

Discussion options

You must be logged in to vote

没有区别。

请看 playground。 你可以通过右边的“JS”标签页查看模板编译后的结果,在21行和22行会发现,@change在编译后会变成onChange,作为createElementVNode的第二个参数传递。

你也可以在官方文档的 渲染函数 发现,如果你使用h()或者jsx,那么应该使用on开头的小驼峰命名法作为prop来注册一个监听事件,比如onChange = @change

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by inside5545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants