解决 cl-select-date 快捷按钮需点击两次的问题
This commit is contained in:
@@ -135,7 +135,9 @@ export class DayUts {
|
|||||||
newDate.setMilliseconds(999);
|
newDate.setMilliseconds(999);
|
||||||
break;
|
break;
|
||||||
case "week":
|
case "week":
|
||||||
newDate.setDate(newDate.getDate() + 7);
|
const day = newDate.getDay();
|
||||||
|
const diff = 6 - day;
|
||||||
|
newDate.setDate(newDate.getDate() + diff);
|
||||||
newDate.setHours(23);
|
newDate.setHours(23);
|
||||||
newDate.setMinutes(59);
|
newDate.setMinutes(59);
|
||||||
newDate.setSeconds(59);
|
newDate.setSeconds(59);
|
||||||
|
|||||||
@@ -271,8 +271,8 @@ const shortcuts = ref<ClSelectDateShortcut[]>([
|
|||||||
{
|
{
|
||||||
label: "本周",
|
label: "本周",
|
||||||
value: [
|
value: [
|
||||||
dayUts().startOf("week").format("YYYY-MM-DD"),
|
dayUts().startOf("week").add(1, "day").format("YYYY-MM-DD"),
|
||||||
dayUts().endOf("week").format("YYYY-MM-DD")
|
dayUts().endOf("week").add(1, "day").format("YYYY-MM-DD")
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { forInObject, isDark, parseClass, rpx2px } from "@/cool";
|
import { forInObject, isDark, isEqual, parseClass, rpx2px } from "@/cool";
|
||||||
import type { ClSelectOption } from "../../types";
|
import type { ClSelectOption } from "../../types";
|
||||||
import { parseRpx } from "@/cool";
|
import { parseRpx } from "@/cool";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
@@ -153,6 +153,11 @@ function onChange(e: UniPickerViewChangeEvent) {
|
|||||||
// 获取选择器当前选中值数组
|
// 获取选择器当前选中值数组
|
||||||
const indexs = e.detail.value;
|
const indexs = e.detail.value;
|
||||||
|
|
||||||
|
// 相同值不触发事件
|
||||||
|
if (isEqual(indexs, props.value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取所有列的值
|
// 获取所有列的值
|
||||||
const values = props.columns.map((c, i) => {
|
const values = props.columns.map((c, i) => {
|
||||||
return c[indexs[i]].value;
|
return c[indexs[i]].value;
|
||||||
|
|||||||
Reference in New Issue
Block a user