简体   繁体   中英

Nuxt.js default layout not being applied

I'm brand new to using Nuxt.js, and having an issue: When I created my project, the layouts folder wasn't generated automatically as documented. I added it manually, but default.vue is not being applied anywhere. Here is layouts/default.vue :

<template>
  <div>
      <AppHeader/>
      <Nuxt/>
  </div>
</template>

I've tried things such as manually setting default as the layout in pages and manually importing the AppHeader component in default.vue (although this is definitely not the issue as other HTML I put there doesn't get rendered either). Not sure what's going wrong here, scratching my head. Using nuxt 2.15.7 . If there's any additional detail needed please let me know what and I'll gladly provide, thanks.

Just define your components folder path in nuxt.config.js

eg: components: { dirs: [ '~/shared', '~/shared/atoms', '~/shared/molecules', '~/shared/organisams', ] },

Today, I faced the same issue, I just stop the dev command and did "npm run dev" again.

It woked like a charm.

I've faced the same problem. Then, just closed the npm run dev command and started again. It worked perfectly for me.

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