Include common header and footer using Vuejs – router-view

In this Post We Will Explain About is Include common header and footer using Vuejs – router-view With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to include header and footer using VueJsExample

In this post we will show you Best way to implement Best way to handle a semi-common header, footer, and side menu using VueJs, hear for Creating a Header and Footer to be Used on all Pages in VueJswith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Vuejs Routing Single Page Application vue-router

how to automatically include your header, navigation, and footer on every page using Vuejs Example

index.html

<div id="liveapp">
  <header>
    <a v-link="{path: '/user1'}" class="button">
      Go to /user1
    </a>
    <a v-link="{path: '/user2'}" class="button">
      Go to /user2
    </a>
  </header>
  <div id="main">
    <router-view>
    </router-view>
  </div>
  <footer>Devloped By : infinityknow.com this is the Footer</footer>
</div>

index.js

Vue.use(VueRouter)

var App = Vue.extend({}) 

var User1 = Vue.extend({
  name: 'User1',
  data() { return { name: 'User1'}},
  template: '<h5>Component 1</h5><p>This is Component 1 : Devloped By : infinityknow.com</p>'
})
var User2 = Vue.extend({
  name: 'User2',
  data() { return { name: 'User2'}},
  template: '<h5>Component 2</h5><p>This is Component 2 : Devloped By : infinityknow.com</p>'
})

var router = new VueRouter({})

router.map({
  '/user1': { component: User1 },
  '/user2': { component: User2 }
})
router.alias({
  '/': '/user1'
})


router.start(App, '#liveapp')

styel.css

header {
  border-bottom: 2px solid black;
  margin-bottom: 15px;
}
footer {
  border-top: 2px solid black;
  margin-top: 15px;
}

Example

READ :  Angularjs Scroll to top With Router Autoscroll

I hope you have Got What is how to automatically include your header, navigation, and footer on every page using Vuejs And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.