|
@@ -20,6 +20,8 @@
|
|
|
v-model:date="date"
|
|
v-model:date="date"
|
|
|
:mode="mode"
|
|
:mode="mode"
|
|
|
:date-config="dateConfig"
|
|
:date-config="dateConfig"
|
|
|
|
|
+ :start="start"
|
|
|
|
|
+ :end="end"
|
|
|
@change="onCalendarChange"
|
|
@change="onCalendarChange"
|
|
|
></cl-calendar>
|
|
></cl-calendar>
|
|
|
</view>
|
|
</view>
|
|
@@ -60,6 +62,7 @@ import { isEmpty, parsePt, parseToObject } from "@/cool";
|
|
|
import type { ClSelectTriggerPassThrough } from "../cl-select-trigger/props";
|
|
import type { ClSelectTriggerPassThrough } from "../cl-select-trigger/props";
|
|
|
import type { ClPopupPassThrough } from "../cl-popup/props";
|
|
import type { ClPopupPassThrough } from "../cl-popup/props";
|
|
|
import { t } from "@/locale";
|
|
import { t } from "@/locale";
|
|
|
|
|
+import { useUi } from "../../hooks";
|
|
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
|
name: "cl-calendar-select"
|
|
name: "cl-calendar-select"
|
|
@@ -97,6 +100,14 @@ const props = defineProps({
|
|
|
type: Array as PropType<ClCalendarDateConfig[]>,
|
|
type: Array as PropType<ClCalendarDateConfig[]>,
|
|
|
default: () => []
|
|
default: () => []
|
|
|
},
|
|
},
|
|
|
|
|
+ // 开始日期,可选日期的开始
|
|
|
|
|
+ start: {
|
|
|
|
|
+ type: String
|
|
|
|
|
+ },
|
|
|
|
|
+ // 结束日期,可选日期的结束
|
|
|
|
|
+ end: {
|
|
|
|
|
+ type: String
|
|
|
|
|
+ },
|
|
|
// 选择器标题
|
|
// 选择器标题
|
|
|
title: {
|
|
title: {
|
|
|
type: String,
|
|
type: String,
|
|
@@ -152,6 +163,9 @@ const props = defineProps({
|
|
|
// 定义事件
|
|
// 定义事件
|
|
|
const emit = defineEmits(["update:modelValue", "update:date", "change", "select"]);
|
|
const emit = defineEmits(["update:modelValue", "update:date", "change", "select"]);
|
|
|
|
|
|
|
|
|
|
+// UI实例
|
|
|
|
|
+const ui = useUi();
|
|
|
|
|
+
|
|
|
// 弹出层引用
|
|
// 弹出层引用
|
|
|
const popupRef = ref<ClPopupComponentPublicInstance | null>(null);
|
|
const popupRef = ref<ClPopupComponentPublicInstance | null>(null);
|
|
|
|
|
|
|
@@ -228,6 +242,9 @@ function clear() {
|
|
|
function confirm() {
|
|
function confirm() {
|
|
|
if (props.mode == "single") {
|
|
if (props.mode == "single") {
|
|
|
if (value.value == null) {
|
|
if (value.value == null) {
|
|
|
|
|
+ ui.showToast({
|
|
|
|
|
+ message: t("请选择日期")
|
|
|
|
|
+ });
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -240,6 +257,9 @@ function confirm() {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
if (isEmpty(date.value)) {
|
|
if (isEmpty(date.value)) {
|
|
|
|
|
+ ui.showToast({
|
|
|
|
|
+ message: t("请选择日期")
|
|
|
|
|
+ });
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|