Vuejs router da js

Esempi di codice

1
0

N

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>

Pagine correlate

Pagine di esempio simili

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................