How to use the vue-router function in vue-router

To help you get started, we’ve selected a few vue-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kruptein / PlanarAlly / ts_src / router.ts View on Github external
import VueRouter from "vue-router";

import Login from './auth/login.vue';
import DashBoard from './dashboard/main.vue'
import Game from './game/game.vue';
// const Game = () => import('./game/game.vue');
import store from './store';

const Initialize = Vue.component("Initialize", {
    data: () => ({
        message: "Loading...",
    }),
    template: "<div>{{ message }}</div>",
});

const router = new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/', redirect: '/dashboard',
        },
        {
            path: '/_load', component: Initialize,
        },
        {
            path: '/auth', component: { template: "" },
            children: [
                { path: 'login', component: Login },
                {
                    path: 'logout',
                    beforeEnter: (to, from, next) =&gt; {
                        axios.post("/api/logout").then(() =&gt; {
github vuikit / vuikit / packages / vuikit / __dev__ / main.js View on Github external
import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuikit from 'vuikit/src/install.esm'
import VuikitIcons from '@vuikit/icons'
import routes from './routes'

import '@vuikit/theme'

Vue.use(VueRouter)
Vue.use(Vuikit)
Vue.use(VuikitIcons)

// register Story components
Vue.component('StoryPositions', require('./components/story-positions.vue').default)

const router = new VueRouter({
  history: true,
  linkActiveClass: 'uk-active',
  routes
})

/* eslint-disable no-new */
new Vue({
  provide: {
    config: {}
  },
  router,
  render: h => h('router-view')
}).$mount('#app')
github furioussoul / esview / ui / src / plugin / router.js View on Github external
import Vue from "vue";
import Router from "vue-router";
import Vuex from "vuex";
import Sync from "vuex-router-sync";

Vue.use(Vuex)
let rs = new Vuex.Store({
  state: {} // 把router的状态同步到state对象
});

export const router = new Router({
  base: '/',
  routes: [
    {
      path: '/',
      component: () =>
        import ('../view/esview/home/home.vue')
    },
    {
      path: '/render',
      component: () =>
        import ('../view/esview/render.vue')
    }
  ]
})

Sync.sync(rs, router, {
github umijs / qiankun / examples / vue / src / main.js View on Github external
export async function mount(props) {
  console.log('props from main framework', props);
  router = new VueRouter({
    base: window.__POWERED_BY_QIANKUN__ ? '/vue' : '/',
    mode: 'history',
    routes,
  });

  instance = new Vue({
    router,
    store,
    render: h => h(App),
  }).$mount('#app');
}
github wangdahoo / vue-scroller / demo / main.js View on Github external
const routes = [
  { path: '/', component: Index },
  { path: '/refreshAndInfinite', component: RefreshAndInfinite },
  { path: '/smoothingScroll', component: SmoothingScroll },
  { path: '/custom', component: Custom },
  { path: '/customSpinner', component: CustomSpinner },
  { path: '/multiScrollers', component: MultiScrollers },
  { path: '/loadMoreAndNoData', component: LoadMoreAndNoData },
  { path: '/snapping', component: Snapping },
  { path: '/noContent', component: NoContent },
  { path: '/loadMoreAndNoData2', component: LoadMoreAndNoData2 },
  { path: '/master-detail', component: Master },
  { path: '/master-detail/:id', component: Detail },
]

const router = new VueRouter({
  routes
})

new Vue({
  router,
  el: '#app',
  template: '',
  components: {
    App
  }
})
github jioo / Dotnet-Core-Attendance-System / WebClient / src / router.js View on Github external
import Vue from 'vue'
import store from '@/store'
import Router from 'vue-router'

Vue.use(Router)

const router = new Router({
    mode: 'history',
    routes: [
        /*
         * ------------------------------------------------------
         *  Home
         * ------------------------------------------------------
         */
        {
            path: '/',
            name: 'home',
            component: () => import('@/views/home')
        },

        /*
         * ------------------------------------------------------
         *  Account login
github l-hammer / v-track / docs / main.js View on Github external
Vue.use(Alert);
Vue.use(Card);
Vue.use(Collapse);
Vue.use(CollapseItem);
Vue.use(VueTrack, {
  trackEvents,
  trackEnable: {
    UVPV: "routeUpdate",
    TONP: true
  }
});

Vue.prototype.$message = Message;
Vue.prototype.$notify = Notification;

const router = new VueRouter({
  routes: [
    {
      path: "/",
      name: "HOME",
      component: Home
    },
    {
      path: "/started",
      name: "STARTED",
      component: Started
    },
    {
      path: "/custom-events",
      name: "CUSTOM_EVENTS",
      component: CustomEvents
    },
github nuxt-community / nuxt7 / lib / templates / f7-router.js View on Github external
export function createRouter () {
  return new Router({
    mode: 'history',
    base: '/',
    fallback: false,
    routes: [
		{
      name: 'main',
			path: '/:route?',
			component: App
		}
    ]
  })
}
github cretueusebiu / laravel-vue-spa / resources / js / router / index.js View on Github external
function createRouter () {
  const router = new Router({
    scrollBehavior,
    mode: 'history',
    routes
  })

  router.beforeEach(beforeEach)
  router.afterEach(afterEach)

  return router
}