简体   繁体   English

knockoutjs可观察数组

[英]knockoutjs observable array

I am trying to create a facebook wall-like application. 我正在尝试创建一个类似Facebook墙的应用程序。

Is there a way that I can add entities to the top of array rather than at the bottom so that I can get a wall like appearance? 有没有办法可以将实体添加到数组的顶部而不是底部,以便我可以获得像外观一样的墙?

You can use observableArray.unshift to add values to the start of the array. 您可以使用observableArray.unshift将值添加到数组的开头。

myObservableArray.unshift('Some new value') inserts a new item at the beginning of the array myObservableArray.unshift('some new value')在数组的开头插入一个新项

You can read more about it in the observableArray documentation . 您可以在observableArray文档中阅读有关它的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM