vue3发布已经有一段时间了,发现网上一些信息更新的太不及时了。现记录。

    原因就是'.native'修饰符在vue3中被弃用了。我看的那个文档没有看到这个。

<template>
  <!-- ✓ 正确写法 -->
  <CoolInput v-on:keydown.enter="onKeydownEnter" />
  <CoolInput @keydown.enter="onKeydownEnter" />

  <!-- ✗ 错误写法 -->
  <CoolInput v-on:keydown.native="onKeydown" />
  <CoolInput @keydown.enter.native="onKeydownEnter" />
</template>

 

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐