ego008 avatar

mithril 路由学习笔记

🕐 by ego008

路由小坑

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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,
})

💘 相关文章

写一条评论

Based on Golang + fastHTTP + sdb | go1.17.1 Processed in 1ms