strette di mano
This commit is contained in:
0
src/components/CTimeAgo/CTimeAgo.scss
Executable file
0
src/components/CTimeAgo/CTimeAgo.scss
Executable file
41
src/components/CTimeAgo/CTimeAgo.ts
Executable file
41
src/components/CTimeAgo/CTimeAgo.ts
Executable file
@@ -0,0 +1,41 @@
|
||||
import { defineComponent, ref, computed, PropType, toRef, onMounted } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
|
||||
import { es, it, enUS } from 'date-fns/locale' // import custom locale
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CTimeAgo',
|
||||
components: {},
|
||||
props: {
|
||||
datetime: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const mylocale = ref(<any>null)
|
||||
|
||||
function mounted() {
|
||||
mylocale.value = enUS
|
||||
if (toolsext.getLocale() === 'it')
|
||||
mylocale.value = it
|
||||
else if (toolsext.getLocale() === 'es')
|
||||
mylocale.value = es
|
||||
}
|
||||
|
||||
mounted()
|
||||
|
||||
return {
|
||||
tools,
|
||||
toolsext,
|
||||
mylocale,
|
||||
}
|
||||
}
|
||||
})
|
||||
19
src/components/CTimeAgo/CTimeAgo.vue
Executable file
19
src/components/CTimeAgo/CTimeAgo.vue
Executable file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<timeago
|
||||
:datetime="datetime"
|
||||
auto-update
|
||||
:converter-options="{
|
||||
includeSeconds: true,
|
||||
addSuffix: true,
|
||||
useStrict: false,
|
||||
}"
|
||||
:locale="mylocale"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CTimeAgo.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CTimeAgo.scss';
|
||||
</style>
|
||||
1
src/components/CTimeAgo/index.ts
Executable file
1
src/components/CTimeAgo/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CTimeAgo} from './CTimeAgo.vue'
|
||||
Reference in New Issue
Block a user