diff options
Diffstat (limited to 'src/components/timeago')
| -rw-r--r-- | src/components/timeago/timeago.vue | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue index 3f185a2d..6df0524d 100644 --- a/src/components/timeago/timeago.vue +++ b/src/components/timeago/timeago.vue @@ -1,5 +1,8 @@ <template> - <time :datetime="time" :title="localeDateString"> + <time + :datetime="time" + :title="localeDateString" + > {{ $t(relativeTime.key, [relativeTime.num]) }} </time> </template> @@ -16,12 +19,6 @@ export default { interval: null } }, - created () { - this.refreshRelativeTimeObject() - }, - destroyed () { - clearTimeout(this.interval) - }, computed: { localeDateString () { return typeof this.time === 'string' @@ -29,6 +26,12 @@ export default { : this.time.toLocaleString() } }, + created () { + this.refreshRelativeTimeObject() + }, + destroyed () { + clearTimeout(this.interval) + }, methods: { refreshRelativeTimeObject () { const nowThreshold = typeof this.nowThreshold === 'number' ? this.nowThreshold : 1 @@ -45,4 +48,4 @@ export default { } } } -</script>
\ No newline at end of file +</script> |
