当前位置: 首页 > 工具软件 > Falcor > 使用案例 >

[Falcor] Building Paths Programmatically

左博学
2023-12-01
model.setValue('genreList[0].titles[0].rating', 5)
                .then(function (value) {
                    model.get('genreList[0..1].titles[0]["name","rating"]')
                            .then(function (json) {
                                console.log(JSON.stringify(json, null, 3));
                            })
                });

 

In the code, we use Javascript path (dot): genreList[0..1].titles[0]["name", "rating"]; 

 

We can also use array syntax:

["genreList", {from: 0, to: 1}, "titles", 0, ["name", "rating"]]

 

They achieve the same result, but using array syntax is more flexable:

var index =0;
["genreList", {from: index, to:index+ 1}, "titles", index, ["name", "rating"]]

Because you can ember the variable.

 

转载于:https://www.cnblogs.com/Answer1215/p/5077416.html

相关阅读

相关文章

相关问答