question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue: I seem to have my layout wrapped in my layout trying to override App.vue...

See original GitHub issue

So, maybe not a bug, probably me, but not sure…

Trying to override App.vue to add route transitions, but I’m getting a double layout situation going on…I’m going off of the tutorial that you just published, but it does not seem to be working properly. Here is a screen shot:

Screen Shot 2019-09-19 at 2 11 26 PM

…and you can see that my layout has another layout inside of it, and I don’t know how to remedy this situation.

Here is my code. First, the App.vue file:

<template>
  <MainLayout>
    <transition name="fade">
      <router-view />
    </transition>
  </MainLayout>
</template>

<static-query>
query App {
  metadata {
    siteName
    siteDescription
  }
}
</static-query>

<script>
import MainLayout from '~/layouts/Main.vue'

export default {
  components: {
    MainLayout
  },
  metaInfo() {
    return {
      title: this.$static.metadata.siteName,
      meta: [
        {
          key: 'description',
          name: 'description',
          content: this.$static.metadata.siteDescription
        }
      ]
    }
  }
}
</script>

<style>

/*----------------------------------------------------------------
Transition Styles
----------------------------------------------------------------*/

.fade-enter-active, .fade-leave-active {
  transition-property: opacity;
  transition-duration: 0.25s;
}

.fade-enter-active {
  transition-delay: 0.25s;
}

.fade-enter, .fade-leave-active {
  opacity: 0
}

</style>

…and my layout file, which is called Main.vue:

<template>
  <div>
    <header>
      <g-link class="nav__link" to="/">Home</g-link>
      <g-link class="nav__link" to="/about/">About</g-link>
    </header>
    <main>
    <slot /> <!-- Page content will be inserted here  -->
    </main>
    <footer>
      <p>Hello People</p>
    </footer>
  </div>
</template>

<style scoped>

div {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 10vh 80vh 10vh;
  grid-template-columns: 100vw;
}

header {
  grid-row: 1;
  background-color: rgb(220,220,220);
}

main {
  grid-row: 2;
  background-color: rgb(200,200,200);;
}

footer {
  grid-row: 3;
  background-color: rgb(220,220,220);;
}

</style>

Any thoughts or pointers would be much appreciated. Thank you 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hjvedvikcommented, Sep 19, 2019

@rchrdnsh The src/pages/Index.vue file is probably also wrapped in a layout component.

1reaction
tomtevcommented, Sep 19, 2019

You should not import any layout to App.vue 😃 You should use it as a wrapper for all other layouts. So the stuff you have in Main.vue should go in App.vue if you want it on all pages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding App.vue - Gridsome
You can override the default file by having your own App.vue file in your src directory. Overriding it is useful if you want...
Read more >
How to override scoped styles in Vue components?
This easily overrides the scoped rules in CompB. Parent overrides. For situations where I want to override both the global and scoped rules....
Read more >
Layouts with Vue.js - How to Create Dynamic Layout ...
First of all, let's update our App base component to prepare it for dynamic layouts. In order to do so, we wrap the...
Read more >
Layouts and Routing | Vue Storefront 2
Layouts and Routing in Vue Storefront are entirely powered by Nuxt.js. ... Open the layouts/default.vue component to get the general idea of how...
Read more >
Style Guide - Vue.js
When using the data property on a component (i.e. anywhere except on new Vue ), the ... For applications, styles in a top-level...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found