关于v-on事件绑定和on开头属性 #1445
baixiaoyu2997
started this conversation in
General
Replies: 1 comment
-
我在 button 中没有写这些事件是因为应该这些和原生事件区别不大,所以没有在文档里面打出来 关于同时被覆盖的问题我觉得这是 vue 的问题,不能说是 bug 吧,至少是个隐性的行为,在 runtime 层面会盖掉 其实在文档里面有类似的章节,但是由于内容比较长只能说让有需要的人再来看。实际上问题是这样的:https://www.naiveui.com/zh-CN/os-theme/docs/common-issues |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
我不太确定这是特性还是bug,所以在这里讨论。
vue3中的这两种写法:
在组件内部获取
props.onClick
时,都是可以获取到的,使用attrs可以做到区分。如果同时定义了
on-click
和@click
那么前面的会被覆盖。我觉得这可能导致隐性bug, 是否应该在文档中体现这种情况,因为我在button组件中没看到
on-click
,但是确实可以用。或者声明最好不要这么做。再或者改为使用
emit
来解决这种问题?Beta Was this translation helpful? Give feedback.
All reactions