ego008
ego008
2157 0 0

mithril 路由学习笔记

路由小坑

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,
})
0

See Also

Nearby


Discussion

Login Topics