出现 defineProps is a compiler macro and no longer needs to be imported. 解决方法

目录

  • 1. 问题所示
  • 2. 原理分析
  • 3. 解决方法

1. 问题所示

执行前端代码的时候,出现如下问题:

[@vue/compiler-sfc] defineProps is a compiler macro and no longer needs to be imported.

[@vue/compiler-sfc] defineEmits is a compiler macro and no longer needs to be imported.

截图如下所示:

出现 defineProps is a compiler macro and no longer needs to be imported. 解决方法_第1张图片

2. 原理分析

在Vue 3中,defineProps和defineEmits是用于在单文件组件(SFC)中定义组件属性和事件的编译器宏

随着Vue的更新,宏的用法发生了一些变化,特别是在Vue 3

你可能感兴趣的:(BUG,javascript,Bug,Vue3,宏)