如何使用momentjs从firebase检索多个值? [英] How can you retrieve multiple values with momentjs from firebase?
本文介绍了如何使用momentjs从firebase检索多个值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从firebase中获取所有数据,并将其存储在数组中,然后从该数组中获取所有post_at数据(发布时的时间).我的目标是以某种时间格式检索所有数据,但问题是它不会检索多个值.我正在使用Vuejs.
I get all data from firebase and store it on array and from that array i take all posted_at data (time when was something posted). My goal is to retrieve all that data in some sort of time format and problem is that it won't retrieve multiple values. I am using Vuejs.
<template>
<div v-for="data in array">
{{ time }}
</div>
</template>
<script>
import moment from 'moment'
export default{
data(){
return{
array:[]//example:1577200868199, 1577200868189,...
}
},
computed:{
time(){
moment(this.array.posted_at).format('MMMM Do YYYY, h:mm:ss a')
}
}
}
</script>
P.S.我尝试过使用for和while循环,但无法正常工作
P.S. I have tried using a for and a while loop but it's not working
推荐答案
使用
这篇关于如何使用momentjs从firebase检索多个值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文