12345678910111213141516171819202122232425262728293031323334 |
- <template>
- <view @click="handleClick">{{ timeago(dateTime, format) }}</view>
- </template>
- <script>
- /**
- * 多久之前组件
- * @description 多久之前组件
- * @property {String, Number, Object} dateTime 日期
- * @property {String} format 格式化
- */
- export default {
- name: 'fs-timeago'
- }
- </script>
- <script setup>
- import timeago from '@/utils/timeago'
- const props = defineProps({
- dateTime: [String, Number, Object],
- format: {
- type: String,
- default: 'YYYY-MM-DD'
- }
- })
- const emits = defineEmits(['click'])
- const handleClick = () => {
- emits('click')
- }
- </script>
- <style></style>
|