0.1.3 • Published 4 years ago
based-router v0.1.3
based-router
一个简单的路由器
import { create, replace, matchPath } from 'based-router';
create(function(location) {
if (matchPath(location, '/')) {
// do something
} else if (matchPath(location, '/list')) {
// do something
} else if (matchPath(location, '/detail/:id')) {
// do something
} else {
// no match
replace('/');
}
});