defineOptions

v3.3+使用 defineOptions 定义组件命名、版本、注册子组件

在v3.3+版本中,可以使用defineOptions方法,定义组件命名、版本、注册子组件 ``` ``` > 注册组件是为了在 template 中使用 component 标签 ``` ``` ......
组件 册子 defineOptions 版本 v3

Server Error `defineOptions()` in <script setup> cannot reference locally declared variables (COMPONENT_NAME) because it will be hoisted outside of the setup() function.

这个错误提示是因为在<script setup>标签中使用了defineOptions()函数,并且该函数中引用了一个本地声明的变量(比如COMPONENT_NAME)。由于<script setup>中的代码会被自动包装在setup()函数内部执行,而defineOptions()函数会被提升到s ......
共2篇  :1/1页 首页上一页1下一页尾页