3

I created a dashboard.vue component and I imported table.vue component into it but the table.vue doesn't appear in my web page and in the vue.dev tools.

When I import the table.vue in app.vue there's no issue.

Below my files.

Thanks in advance!

//dashboard.vue

<template>
  <div>

  <table></table>

  </div>
</template>

<script>


import table from "./table";

 export default {
  name: 'Dashboard',
  component: {
    table, 
  }

}
</script>


<style >

</style>

//table.vue

<template>
  <div>
      <p>Test</p>

  </div>
</template>

<script>





export default {
  name: 'Table',

}
  </script>
1
  • Welcome, can you upload your code on here: codesandbox.io Commented Apr 10, 2020 at 19:03

1 Answer 1

2

You cannot name components the same as reserved HTML elements. Change it to my-table.

You'll need to map it:

components: {
    'my-table': table, 
  }
Sign up to request clarification or add additional context in comments.

4 Comments

I replaced all table by mytable and I get
Unknown custom element: <mytable> - did you register the component correctly? For recursive components, make sure to provide the "name" option. found in ---> <Dashboard> at src/components/Dashboard.vue <App> at src/App.vue <Root>
when I import it in the app.vue there's no issue with both "table" and 'mytable"
shouldn't it be "components" not "component"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.