fs-date-format.vue 429 B

1234567891011121314151617181920212223242526272829
  1. <template>
  2. <view>
  3. {{dateFormat}}
  4. </view>
  5. </template>
  6. <script setup>
  7. import { computed } from 'vue'
  8. import dayjs from 'dayjs'
  9. const props = defineProps({
  10. date: [String, Object],
  11. format: {
  12. type: String,
  13. default: 'YYYY-MM-DD'
  14. }
  15. })
  16. const emits = defineEmits(['click'])
  17. const dateFormat = computed(() => dayjs(props.date).format(props.format))
  18. const handleClick = () => {
  19. emits('click')
  20. }
  21. </script>
  22. <style>
  23. </style>