父组件在使用组件标签(子组件),如果想在标签中加入事件绑定,要在事件后加入.native修饰符
<ArticleInfo
v-for="item in articleList"
:key="item.id"
:id="item.id"
:title="item.title"
:introduce="item.summary"
:author="item.author.nickname"
:views="item.viewCounts"
:comment="item.commentCounts"
:date="item.createDate"
@mouseenter.native="mouseenter($event)"
@mouseleave.native="mouseleave($event)"
></ArticleInfo>
元素html标签不能加.native修饰符
参考链接
本文介绍了在Vue组件中使用`.native`修饰符来在标签内绑定事件的方法,重点讲解了为什么在HTML标签上不直接使用修饰符,以及提供了一个实例以帮助理解其用法。
53

被折叠的 条评论
为什么被折叠?



