Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
install(){
OmiRouter.init({
routes: [
{path: '/about', component: () => import("../intro/index.js")}
],
renderTo: "#view",
defaultRoute: '/',
root: this
})
}
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
})
}
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
}