vue-router#createRouter JavaScript Examples

The following examples show how to use vue-router#createRouter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.js    From vitedge with MIT License 7 votes vote down vote up
export function resolvePropsRoute(routes, path, base) {
  const url = createUrl(path)
  url.pathname = withoutPrefix(url.pathname, PROPS_PREFIX + '/')

  const routeBase = base && withoutSuffix(base({ url }), '/')
  const fullPath = getFullPath(url, routeBase)

  const router = createRouter({
    routes,
    history: createMemoryHistory(routeBase),
  })

  return buildPropsRoute(router.resolve(fullPath))
}
Example #2
Source File: app.js    From f5-appsvcs-templates with Apache License 2.0 6 votes vote down vote up
router = createRouter({
    history: createWebHashHistory(),
    routes: [
        { path: '/', redirect: '/templates' },
        { path: '/applications', component: pageComponents.applications },
        { path: '/create/:tmplid(.*)', component: pageComponents.create },
        { path: '/modify/:appid(.*)', component: pageComponents.create },
        { path: '/resubmit/:taskid', component: pageComponents.create },
        { path: '/tasks', component: pageComponents.tasks },
        { path: '/settings', component: pageComponents.settings },
        { path: '/api', component: pageComponents.api },
        { path: '/templates', component: pageComponents.templates },
        // Fixes for embedding in TMUI
        { path: '/application/*/edit', redirect: '/' },
        { path: '/iapps/f5-appsvcs-templates/index.html', redirect: '/templates' },
        { path: '/img/fastrobot.png', redirect: '/iapps/f5-appsvcs-templates/img/fastrobot.png' },
        { path: '/*/undefined', redirect: '/#' }
    ]
})
Example #3
Source File: index.js    From ant-simple-pro with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})
Example #4
Source File: life-cycle.js    From wl-mfe with Apache License 2.0 5 votes vote down vote up
render = ({ routes, routerBase, container } = {}) => {
  // Vue.config.productionTip = false;
  router = createRouter({
    history: createWebHistory(__qiankun__ ? routerBase : "/"),
    routes: __qiankun__ ? routeMatch(routes, routerBase) : selfRoutes
  });
  instance = createApp(App).use(router).use(store).mount(container ? container.querySelector("#app") : "#app");
}
Example #5
Source File: create-router.output.js    From vue-cli-plugin-vue-next with MIT License 5 votes vote down vote up
createRouter({
  history: createWebHashHistory(),
  routes
});
Example #6
Source File: create-router.output.js    From vue-cli-plugin-vue-next with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})
Example #7
Source File: create-history.output.js    From vue-cli-plugin-vue-next with MIT License 5 votes vote down vote up
createRouter({
  history: createWebHistory(),
  routes
});
Example #8
Source File: create-history.output.js    From vue-cli-plugin-vue-next with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
Example #9
Source File: index.js    From p2p-tunnel with GNU General Public License v2.0 5 votes vote down vote up
router = createRouter({
    history: createWebHashHistory(),
    routes
})
Example #10
Source File: index.js    From p2p-tunnel with GNU General Public License v2.0 5 votes vote down vote up
router = createRouter({
    history: createWebHashHistory(),
    routes
})
Example #11
Source File: main.js    From LoR_Master with MIT License 5 votes vote down vote up
router = createRouter({
  history: IS_ELECTRON ? createMemoryHistory() : createWebHistory(),
  routes, // short for `routes: routes`
})
Example #12
Source File: router.js    From restqa with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  scrollBehavior() {
    return {
      left: 0,
      top: 0
    };
  },
  routes: [
    {
      path: isBeta ? "/" : "/coming-soon",
      component: () => import("./layouts/FullPage.vue"),
      children: [
        {
          path: "",
          name: "page-coming-soon",
          component: () => import("./views/pages/ComingSoon.vue"),
          meta: {
            title: "Coming soon!"
          }
        }
      ]
    },
    {
      path: isBeta ? "/beta" : "/",
      component: () => import("./layouts/Dashboard.vue"),
      children: [
        {
          path: "",
          name: "homepage",
          component: () => import("./views/Homepage.vue"),
          meta: {
            title: "Dashboard"
          }
        },
        {
          path: "/steps",
          name: "steps",
          component: () => import("./views/Steps/Steps.vue"),
          meta: {
            title: "Step definition"
          }
        },
        {
          path: "/editor",
          name: "editor",
          component: () => import("./views/editor/Editor.vue"),
          meta: {
            title: "Editor"
          }
        },
        {
          path: "/sandbox",
          name: "sandbox",
          component: () => import("./views/sandbox/Sandbox.vue"),
          meta: {
            title: "Sandbox"
          }
        }
      ]
    }
  ]
})
Example #13
Source File: index.js    From vue-form-render with MIT License 5 votes vote down vote up
router = createRouter({
  routes, // short for `routes: routes`
  history: createWebHashHistory(),
})
Example #14
Source File: router.js    From uptime-kuma with MIT License 5 votes vote down vote up
router = createRouter({
    linkActiveClass: "active",
    history: createWebHistory(),
    routes,
})
Example #15
Source File: main.js    From Ale with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(),
  routes
})
Example #16
Source File: index.js    From tools-vue with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(),
  routes,
})
Example #17
Source File: index.js    From konsta with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(),
  routes,
})
Example #18
Source File: index.js    From double-take with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHistory(window.ingressUrl || window.publicPath || ''),
  routes,
  scrollBehavior() {
    // Scroll to the top of the page on route navigation
    return { x: 0, y: 0 };
  },
})
Example #19
Source File: index.js    From fantastic-startkit with MIT License 5 votes vote down vote up
router = createRouter({
    history: createWebHashHistory(),
    routes
})
Example #20
Source File: index.js    From fantastic-admin with MIT License 5 votes vote down vote up
router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes
})
Example #21
Source File: index.js    From certd with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(),
  routes
})
Example #22
Source File: routes.js    From WirtBot with GNU Affero General Public License v3.0 5 votes vote down vote up
router = new createRouter({
  history: createWebHashHistory(),
  routes,
})
Example #23
Source File: index.js    From vue3-element-admin with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes
})
Example #24
Source File: main.js    From vue.draggable.next with MIT License 5 votes vote down vote up
router = createRouter({
  history: createWebHashHistory("/vue.draggable.next/"),
  routes
})