Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

router configuration vue

npm install --save vue-router

//after installing vue-router in the project
//go inside main.js in your project and add
//(just after Vue.config.productionTip=false):

Vue.use(VueRouter):

const routes=[
{path: '/home', component: [componentName]},
{path: '/features', component: [componentName2]},
.
.
.
];
//you can add  as many routes as you need

//also add:

const router=new VueRouter({
routes,
mode: 'history'
});


//to make the router accesible for all the project you need to add it inside the new Vue:

new Vue({
router,     <----
.
.
}).$mount('#app')

//to make different pages acoording to the route selected, add (inside app.vue):
<template>
   <div id="app">
     <Navbar></Navbar>

     <router-view> </router-view>  <----------
     <Footer></Footer>
   </div>
</template>

Comment

PREVIOUS NEXT
Code Example
Typescript :: get elements in list in another list c# 
Typescript :: typescript typecast 
Typescript :: mat-sort not working in dynamically generated table 
Typescript :: find all running ports node 
Typescript :: typescript type array of interface 
Typescript :: get key value typescript 
Typescript :: typescript function as parameter 
Typescript :: how to edit multiple inputs react 
Typescript :: how to link custom fonts in react native 
Typescript :: event type typescript angular 
Typescript :: absolute cell reference in excel and google sheets 
Typescript :: declare object array in typescript 
Typescript :: typescript axios 
Typescript :: navigate in new tab with query params angular 
Typescript :: give all element in a list starts with string 
Typescript :: whats $_.FullName in powershell 
Typescript :: array of objects value repeat check 
Typescript :: nest js parseint pipe 
Typescript :: basic variable types in typescript 
Typescript :: angle between two vectors 
Typescript :: typescript loop types 
Typescript :: typescript get the promise return type 
Typescript :: msgpack lite 
Typescript :: HeroService: getHeroes failed: Http failure response for http://localhost:4200/api/heroes: 404 Not Found 
Typescript :: how to check if a value exists in unorderedmaps 
Typescript :: css how to make a elements of same type start at same height 
Typescript :: print all alphabets from a to z in java 
Typescript :: rest parameters in typescript 
Typescript :: get enum value dynamically typescript 
Typescript :: typescript interface 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =