在这里插入图片描述

[@vue/compiler-sfc] `defineProps()` in <script setup> cannot reference locally 
declared variables because it will be hoisted outside of the setup() function.
 If your component options require initialization in the module scope, 
 use a separate normal <script> to export the options instead.

解决方法是新开一个script标签,把defineProps放在setup中

SFC = Single File Component(单文件组件)

参考文章

https://stackoverflow.com/questions/69951687/vue-3-defineprops-are-referencing-locally-declared-variables

https://www.cnblogs.com/optre/p/17295649.html

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐