Skip to content

Instantly share code, notes, and snippets.

@dlodeprojuicer
Last active April 23, 2020 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlodeprojuicer/a1dc82f187478165da1ed265426d6a9d to your computer and use it in GitHub Desktop.
Save dlodeprojuicer/a1dc82f187478165da1ed265426d6a9d to your computer and use it in GitHub Desktop.
Basic vue route structure
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