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.
截图如下所示:
2. 原理分析
在Vue 3中,defineProps和defineEmits是用于在单文件组件(SFC)中定义组件属性和事件的编译器宏
随着Vue的更新,宏的用法发生了一些变化,特别是在Vue 3