二级路由
二级路由需要用到 next()
方法传递下去,以及 res.subRoute()
生成二级页面渲染的节点
import SMERouter from 'sme-router'
const router = new SMERouter('router-view')
router.route('/main', (req, res, next) => {
next(`
<h2>Main title</h2>
${res.subRoute()}
`)
})
router.route('/main/:content', (req, res, next) => {
res.render(
`Iam nested content`
)
})
router.go('/main/sample')