简体   繁体   中英

[Vue warn]: Failed to resolve component: Header at <App>

My component doesn't render and I get the above warning in the console. This is my first Vue project, so I am struggling to understand where the issue lies.

This is my App.vue:

<template>
  <Header />
</template>

<script>
import Header from "./components/Header";

export default {
  setup() {
    return {
      Header,
    };
  },
};
</script>

And this is the Header component, I am trying to render, Header.vue:

<template>
  <header>
    <h1>Income Tracker</h1>
    <div class="total-income">€0</div>
  </header>
</template>

<script>
export default {};
</script>

Any idea where I am going wrong?

Like in Vue 2:

 <script> import Header from "./components/Header"; export default { components { Header }, }; </script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM