在vue3中setup语法糖使用onMounted报警告

明明没有使用async setup() 为什么也会报出这个警告呢
不让我添加图片

<script setup>
import { reactive, computed, onMounted } from 'vue';
const loadingInstance = ElLoading.service();
onMounted(() => {
  loadingInstance.close()
})
</script>

runtime-core.esm-bundler.js?5c40:38 [Vue warn]: onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.

阅读 11.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏