fs-timeago.vue 375 B

1234567891011121314151617181920212223242526
  1. <template>
  2. <view @click="handleClick">
  3. {{timeago(dateTime, format)}}
  4. </view>
  5. </template>
  6. <script setup>
  7. import timeago from '@/utils/timeago'
  8. const props = defineProps({
  9. dateTime: [String, Number],
  10. format: {
  11. type: String,
  12. default: 'YYYY-MM-DD'
  13. }
  14. })
  15. const emits = defineEmits(['click'])
  16. const handleClick = () => {
  17. emits('click')
  18. }
  19. </script>
  20. <style>
  21. </style>