Last active
April 23, 2020 09:16
-
-
Save dlodeprojuicer/a1dc82f187478165da1ed265426d6a9d to your computer and use it in GitHub Desktop.
Basic vue route structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
// for Vue setup only | |
import VueRouter from 'vue-router' | |
// for Ionic-Vue setup only | |
import { IonicVueRouter } from "@ionic/vue"; | |
import Home from "./views/Home" | |
import About from "./views/About" | |
import Contact from "./views/Contact" | |
import AnotherPage from "./views/AnotherPage" | |
// for Vue setup only | |
Vue.use(VueRouter) | |
// for Ionic-Vue setup only | |
Vue.use(IonicVueRouter) | |
const routes = [ | |
{ | |
path: "/home", | |
name: "home", | |
component: Home, | |
meta: { | |
requiresAuth: false | |
} | |
} | |
{ | |
path: "/about", | |
name: "about", | |
component: About, | |
meta: { | |
requiresAuth: false | |
} | |
} | |
{ | |
path: "/contact", | |
name: "contact", | |
component: Contact, | |
meta: { | |
requiresAuth: false | |
} | |
}, | |
{ | |
path: "/another-page", | |
name: "another-page", | |
component: AnotherPage, | |
meta: { | |
requiresAuth: false | |
} | |
} | |
]; | |
// for Vue setup only | |
const router = new VueRouter({ | |
routes // short for `routes: routes` | |
}); | |
// for Ionic-Vue setup only | |
export default new IonicVueRouter({ | |
routes | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment