0👍
I don’t use firebase, but it looks like db reference provides orderByKey
, so…
let postRef = db.ref('posts').orderByKey('timestamp');
An alternative would be sorting yourself, after retrieval…
this.allPosts = Object.values(val).flatMap(posts =>
Object.entries(posts).map(([ _key, post ]) => ({ _key, ...post}))
).sort((a, b) => a.timestamp.toMillis() - b.timestamp.toMillis());
- [Vuejs]-How can I change the placeholder color from my el-input with Element UI
- [Vuejs]-How can I get the value from this multiple array object with VueJs
Source:stackexchange.com