|
@@ -11,6 +11,7 @@
|
|
import { ref, onMounted } from 'vue';
|
|
import { ref, onMounted } from 'vue';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
import { useVModel } from '@vueuse/core';
|
|
import { useVModel } from '@vueuse/core';
|
|
|
|
+import { dateFormat } from '@/utils/tool';
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
modelValue: Array,
|
|
modelValue: Array,
|
|
});
|
|
});
|
|
@@ -27,13 +28,18 @@ const range = useVModel(props, 'modelValue', emit);
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
if (!props.modelValue?.length) {
|
|
if (!props.modelValue?.length) {
|
|
|
|
+ const now = Date.now();
|
|
range.value = [
|
|
range.value = [
|
|
- dayjs().startOf('year').format('YYYY-MM-DD'),
|
|
|
|
- dayjs().endOf('year').format('YYYY-MM-DD'),
|
|
|
|
|
|
+ // dayjs().startOf('year').format('YYYY-MM-DD'),
|
|
|
|
+ // dayjs().endOf('year').format('YYYY-MM-DD'),
|
|
|
|
+ dateFormat(now - 31536000000, 'yyyy-MM-dd'),
|
|
|
|
+ dateFormat(now, 'yyyy-MM-dd'),
|
|
];
|
|
];
|
|
emit('timeChange', [
|
|
emit('timeChange', [
|
|
- dayjs().startOf('year').format('YYYY-MM-DD'),
|
|
|
|
- dayjs().endOf('year').format('YYYY-MM-DD'),
|
|
|
|
|
|
+ // dayjs().startOf('year').format('YYYY-MM-DD'),
|
|
|
|
+ // dayjs().endOf('year').format('YYYY-MM-DD'),
|
|
|
|
+ dateFormat(now - 31536000000, 'yyyy-MM-dd'),
|
|
|
|
+ dateFormat(now, 'yyyy-MM-dd'),
|
|
]);
|
|
]);
|
|
}
|
|
}
|
|
});
|
|
});
|