How to use omi-router - 3 common examples

To help you get started, we’ve selected a few omi-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 AlloyTeam / omi-cli / template / spa / src / component / hello / index.js View on Github external
install(){
        OmiRouter.init({
            routes: [
                {path: '/about', component: () => import("../intro/index.js")}
            ],
            renderTo: "#view",
            defaultRoute: '/',
            root: this
        })
    }
github Tencent / omi / pr / example / spa / src / main.js View on Github external
install() {
        OmiRouter.init({
            routes: [
                {path: '/', component: Home},
                {path: '/about', component: About},
                {path: '/user-list', component: UserList},
                {path: '/user/:name/category/:category', component: User}
            ],
            renderTo: "#view",
            defaultRoute: '/',
            root: this
        })
    }
github Tencent / omi / packages / templates-old / spa / src / route / index.js View on Github external
export default function(omiElement) {
  for (let item of routeList) {
    route(item.path, evt => {
      window.document.title = item.label
      omiElement.data.pageTitle = item.label
      omiElement.data.tag = item.tag
      omiElement.data.routeParams = evt.params
      omiElement.data.routeQuery = evt.query
      routeList.forEach(routeItem => (routeItem.selected = false))
      item.selected = true
    })
  }
  return routeList
}

omi-router

Router for Omi

MIT
Latest version published 7 months ago

Package Health Score

72 / 100
Full package analysis

Popular omi-router functions