1

我想使用 Knockout 将结构绑定到从 REST 服务返回的分层 JSON。采用以下形式:

[{
    Name: "Page 1",
    Children: [ {
        Name: "Page 1 > 1",
        Children: [{
        Name: "Page 1 > 1 > 1",
        Children: []
    }
,{
        Name: "Page 1 > 1 > 2",
        Children: []
    }
]
    }
    ]
},
{
    Name: "Page 2",
    Children: [
    {
        Name: "Page 16",
        Children: []
    }
    ]
},
{
    Name: "Page 3",
    Children: [
    {
        LocalizedName: "aaaaa",
        Children: []
    }
]

标准(foreach)绑定只返回顶层。有什么好的方法可以做到这一点吗?

谢谢。

4

0 回答 0