mithril 路由学习笔记

By ego008 at 2017-12-16 20:08 • 411次点击
ego008

路由小坑

var Home = {
    view: function() {
        return m("a[href='/home2']", {oncreate: m.route.link}, "go to Home 2")
    }
}
var Home2 = {
    view: function() {
        return m("a[href='#!/home']", "go to Home")
    }
}

m.route(document.body, "/home", {
    "/home": Home, // defines `http://localhost/#!/home`
    "/home2": Home2,
})

mithril, 路由, 笔记


目前尚无回复
登录 后发表评论