Simple Vue Router Example From Scratch

Today, We want to share with you Simple Vue Router Example From Scratch.In this post we will show you Vue.js Routing With vue-router, hear for Introduction to Routing in Vue.js with vue-router we will give you demo and example for implement.In this post, we will learn about Vue Router Tutorial With Example – How To Use Routing in VueJS with an example.

Simple Vue Router Example From Scratch

There are the Following The simple About Simple Vue Router Example From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Vue Router Example From Scratch, so the vue router default route Directory structures for this example is following below.

vuejs/vue-router Example

Step 1: External Libs

Include the library in the page

Step 2: Add Vuejs JavaScript Part

console.log('Yes! We are using Vue version', Vue.version)


const Dashboard = {
	template: `


`, } const Product = { template: `

My Product

`, } const Product = { template: `


`, } const routes = [ { path: '/', name: 'dashboard', component: Dashboard }, { path: '/shop', name: 'shop', component: Product }, { path: '/product', name: 'product', component: Product }, ] const router = new VueRouter({ routes, }) // New VueJS instance var app = new Vue({ // CSS selector of the root DOM element el: '#app', // Inject the router into the app router, })

Step 3: Include HTML

Step 4: Include CSS

body {
  font-family: sans-serif;

a {
  color: #41b883;
  text-decoration: none;

a.router-link-active {
  font-weight: bold;
  text-decoration: underline;
Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Simple Vue Router Example From Scratch.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment