12345678910111213141516171819202122232425262728293031323334353637 |
- <template>
- <view>{{ dateFormat }}</view>
- </template>
- <script>
- /**
- * 日期格式化组件
- * @description 日期格式化组件
- * @property {String, Object} date 日期
- * @property {String} format 格式化
- */
- export default {
- name: 'fs-date-format'
- }
- </script>
- <script setup>
- import { computed } from 'vue'
- import dayjs from 'dayjs'
- const props = defineProps({
- date: [String, Object],
- format: {
- type: String,
- default: 'YYYY-MM-DD'
- }
- })
- const emits = defineEmits(['click'])
- const dateFormat = computed(() => dayjs(props.date).format(props.format))
- const handleClick = () => {
- emits('click')
- }
- </script>
- <style></style>
|