[修复] datePicker组件中的选中后判定问题导致无法修改传入对象

This commit is contained in:
castleiMac 2022-04-03 20:18:08 +08:00
parent d54cf9933f
commit 1b851c4212
2 changed files with 11 additions and 7 deletions

View File

@ -14,6 +14,7 @@
::: demo
<template>
选择的时间:{{endTime}}
<lay-date-picker v-model="endTime"></lay-date-picker>
</template>
@ -23,7 +24,7 @@ import { ref } from 'vue'
export default {
setup() {
const endTime = ref("2022-03-04 17:35:00");
const endTime = ref("2022-03-14 17:35:00");
return {
endTime
@ -40,6 +41,7 @@ export default {
::: demo
<template>
选择的时间:{{endTime2}}
<lay-date-picker type="datetime" v-model="endTime2"></lay-date-picker>
</template>
@ -66,6 +68,7 @@ export default {
::: demo
<template>
选择的时间:{{endTime3}}
<lay-date-picker type="year" v-model="endTime3"></lay-date-picker>
</template>
@ -92,6 +95,7 @@ export default {
::: demo
<template>
选择的时间:{{endTime4}}
<lay-date-picker type="month" v-model="endTime4"></lay-date-picker>
</template>

View File

@ -1,7 +1,7 @@
<template>
<div>
<lay-dropdown ref="dropdownRef">
<lay-input :name="name" :value="dateValue" readonly>
<lay-input :name="name" :value="dateValue" readonly="readonly">
<template #prefix>
<lay-icon type="layui-icon-date"></lay-icon>
</template>
@ -100,11 +100,11 @@
</div>
</div>
<div class="layui-laydate-footer">
<span
<!-- <span
class="layui-laydate-preview"
title="当前选中的结果"
style="color: rgb(102, 102, 102)"
>2022</span>
>2022</span>-->
<div class="laydate-footer-btns">
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span>
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span>
@ -147,11 +147,11 @@
</div>
</div>
<div class="layui-laydate-footer">
<span
<!-- <span
class="layui-laydate-preview"
title="当前选中的结果"
style="color: rgb(102, 102, 102)"
>2022-03</span>
>2021-03</span>-->
<div class="laydate-footer-btns">
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span>
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span>
@ -280,7 +280,7 @@ const dateValue = computed<string>(() => {
return "";
}
let momentVal;
let momentObj = moment(props.modelValue || currentDay.value)
let momentObj = moment(currentDay.value || props.modelValue)
momentVal = momentObj.format(fmtMap[props.type])
if (momentVal != props.modelValue)
$emits("update:modelValue", momentVal);