javascript - KnockoutJs如何实现组件递归,实现树形列表?
ringa_lee
ringa_lee 2017-04-11 08:59:35
0
1
494

我想实现这样的例子:http://cn.vuejs.org/examples/...
它是用vue实现的,用ko的怎么做到?
我的数据结构类似这样(层级不确定):

var data=[
                {
                    id:1,
                    "text": "111-1",
                    "children": []
                }, 
                {
                    id:2,
                    "text": "111-2",
                    "children": [
                    {
                        id:2-1,
                        "text": "111-2-1",
                        "children": [
                            {
                                id:2-1-1,
                                "text": "111-2-1-1",
                                "children": [
                                    {
                                        id:2-1-1-1,
                                        "text": "111-2-1-1-1",
                                        "children": []
                                    }
                                ]
                            },
                            {
                                id:2-1-2,
                                "text": "111-2-1-2",
                                "children": []
                            }
                        ]
                    }, 
                    {
                        id:2-2,
                        "text": "111-2-2",
                        "children": []
                    },                     
                    {
                        id:2-3,
                        "text": "111-2-3",
                        "children": []
                    }
                    ]
                }
            ]

请大神们指教。

ringa_lee
ringa_lee

ringa_lee

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!