Danish

Posted 02-Jan-2021 | 99 | Vue

How to add vuejs multiple components on a page?

I am using VueJS for the front end work. So far I know how to add components in vuejs file. I am using Vue CLI 3 to create a project with it. So here the problem is I have components and views two folders and both contain .vue files. I know we can have parent components that can use child components. Previously I did it like this, Suppose I have two files HelloWorld.vue and then have another vue file called Comp1.vue Now if I want to include the 1st component into the 2nd one I can do the following

import HelloWorld from 'HelloWorld'
export default {
    name: 'Comp1',
    components: {
        HelloWorld
    }
}

Can someone please explain whats the purpose of the views folder and how to add multiple components to a page?

Replies