Home > Mobile >  Insert 2 components in nuxt.js page
Insert 2 components in nuxt.js page

Time:11-02

i'm new of this framework :( the problem is here because i've tried to put the component in another page and work it.

It sign error the component

this is my index.vue page enter image description here

CodePudding user response:

If you're using nuxt2.0, you should wrap them in a container but this is not needed in nuxt3.0.

<template>
  <main>
    <navbar />
    <slideshow />
  </main>
</template>

If this is nuxt2.0, then you should also import the component and register it but you haven't done it here. The path you've given to the component is not correct also.

<script>
import Slideshow from '~/components/slideshow.vue';

export default {
  components: { Slideshow }
}
</script>

CodePudding user response:

You need to wrap the into a div or any other tag (to not have multiple tags at the root of the template) like that

<template>
  <div>
    <navbar></navbar>
    <slideshow></slideshow>
  </div>
</template>

And you can also skip the import part because Nuxt is already doing that for you as explained here: https://nuxtjs.org/tutorials/improve-your-developer-experience-with-nuxt-components/

  • Related