This is a mini frontend router.
npm i fe-router -D
const FERouter = require('fe-router')
const routeMap = {
'/': function () {
xxx
},
'/1': function () {
xxx
}
}
const router = new FERouter({
history: false, // true: history model, false: hash model, default model: hash model
routeMap
})
router.push('/')
router.push('/1')