vue.jsvuejs3nuxt3.jsweb-frontend

What are the differences between the app.vue and pages/index.vue files in Nuxt?


I'm new to Nuxt and got confused about when to use app.vue or /pages/index.vue .When do I use either of them or what is the purpose of using index.vue if the starting point is app.vue .


Solution

  • app.vue is your main entry point, like main.js in Vue, the top level you can get access to if you want to have some thing across your whole app.

    /pages/index.vue is used to generate some content on the home of your app aka /, this is mainly some vue-router path done for you.
    In the same way, /pages/about.vue will generate a page for /about.

    So, mainly all the router pages are contained within app.vue.