|
|
@@ -16,9 +16,17 @@ const props = defineProps({
|
|
|
type RangeValue = [Dayjs, Dayjs];
|
|
|
|
|
|
const value = ref<RangeValue>();
|
|
|
+// 日期连接字符串
|
|
|
+const concatChar = ' 至 ';
|
|
|
|
|
|
onMounted(() => {
|
|
|
- const [from, to] = props.data.value.split(' ');
|
|
|
+ const v = props.data.value;
|
|
|
+ let from = '', to = '';
|
|
|
+ if (v.includes(concatChar)) {
|
|
|
+ [from, to] = v.split(concatChar);
|
|
|
+ } else {
|
|
|
+ [from, to] = props.data.value.split(' ');
|
|
|
+ }
|
|
|
const dateFrom = dayjs(from);
|
|
|
const dateTo = dayjs(to);
|
|
|
if (dateFrom.isValid() && dateTo.isValid()) {
|
|
|
@@ -35,7 +43,7 @@ function onNameChange(e: InputEvent) {
|
|
|
}
|
|
|
|
|
|
function onValueChange(_: Dayjs | string, dateString: [string, string]) {
|
|
|
- change(props.data.name, dateString.join(' '));
|
|
|
+ change(props.data.name, dateString.join(concatChar));
|
|
|
}
|
|
|
|
|
|
function change(name: string, value: string) {
|