首页  >  问答  >  正文

未使用的定义:“HelloWorld”

App.vue 文件

<template lang="pug">
div
  hello-world
</template>
<script setup lang="ts">
import HelloWorld from "./components/HelloWorld.vue";
</script>

HelloWorld.vue 文件

<template lang="pug">
div
  h1 {{ msg }}
</template>

<script setup lang="ts">
import { ref } from "vue";

const msg = ref<string>("Hello World!!!");
</script>

问题是什么以及如何解决?在 vue3 中同时使用 typescript、composition API 和 pug 模板时遇到此问题。关心的是如何使用组合 API 导入组件并在 pug 模板中使用它?

P粉106711425P粉106711425204 天前408

全部回复(1)我来回复

  • P粉762447363

    P粉7624473632024-03-30 11:27:24

    我很确定问题来自预安装打字稿。删除打字稿作为脚本语言应该可以解决问题: