[修复] datePicker组件中的选中后判定问题导致无法修改传入对象
This commit is contained in:
parent
d54cf9933f
commit
1b851c4212
@ -14,6 +14,7 @@
|
|||||||
::: demo
|
::: demo
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
选择的时间:{{endTime}}
|
||||||
<lay-date-picker v-model="endTime"></lay-date-picker>
|
<lay-date-picker v-model="endTime"></lay-date-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ import { ref } from 'vue'
|
|||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
const endTime = ref("2022-03-04 17:35:00");
|
const endTime = ref("2022-03-14 17:35:00");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
endTime
|
endTime
|
||||||
@ -40,6 +41,7 @@ export default {
|
|||||||
::: demo
|
::: demo
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
选择的时间:{{endTime2}}
|
||||||
<lay-date-picker type="datetime" v-model="endTime2"></lay-date-picker>
|
<lay-date-picker type="datetime" v-model="endTime2"></lay-date-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -66,6 +68,7 @@ export default {
|
|||||||
::: demo
|
::: demo
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
选择的时间:{{endTime3}}
|
||||||
<lay-date-picker type="year" v-model="endTime3"></lay-date-picker>
|
<lay-date-picker type="year" v-model="endTime3"></lay-date-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -92,6 +95,7 @@ export default {
|
|||||||
::: demo
|
::: demo
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
选择的时间:{{endTime4}}
|
||||||
<lay-date-picker type="month" v-model="endTime4"></lay-date-picker>
|
<lay-date-picker type="month" v-model="endTime4"></lay-date-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<lay-dropdown ref="dropdownRef">
|
<lay-dropdown ref="dropdownRef">
|
||||||
<lay-input :name="name" :value="dateValue" readonly>
|
<lay-input :name="name" :value="dateValue" readonly="readonly">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<lay-icon type="layui-icon-date"></lay-icon>
|
<lay-icon type="layui-icon-date"></lay-icon>
|
||||||
</template>
|
</template>
|
||||||
@ -100,11 +100,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-laydate-footer">
|
<div class="layui-laydate-footer">
|
||||||
<span
|
<!-- <span
|
||||||
class="layui-laydate-preview"
|
class="layui-laydate-preview"
|
||||||
title="当前选中的结果"
|
title="当前选中的结果"
|
||||||
style="color: rgb(102, 102, 102)"
|
style="color: rgb(102, 102, 102)"
|
||||||
>2022</span>
|
>2022</span>-->
|
||||||
<div class="laydate-footer-btns">
|
<div class="laydate-footer-btns">
|
||||||
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span>
|
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span>
|
||||||
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span>
|
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span>
|
||||||
@ -147,11 +147,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-laydate-footer">
|
<div class="layui-laydate-footer">
|
||||||
<span
|
<!-- <span
|
||||||
class="layui-laydate-preview"
|
class="layui-laydate-preview"
|
||||||
title="当前选中的结果"
|
title="当前选中的结果"
|
||||||
style="color: rgb(102, 102, 102)"
|
style="color: rgb(102, 102, 102)"
|
||||||
>2022-03</span>
|
>2021-03</span>-->
|
||||||
<div class="laydate-footer-btns">
|
<div class="laydate-footer-btns">
|
||||||
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span>
|
<span lay-type="clear" class="laydate-btns-clear" @click="clear">清空</span>
|
||||||
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span>
|
<span lay-type="now" class="laydate-btns-now" @click="now">现在</span>
|
||||||
@ -280,7 +280,7 @@ const dateValue = computed<string>(() => {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
let momentVal;
|
let momentVal;
|
||||||
let momentObj = moment(props.modelValue || currentDay.value)
|
let momentObj = moment(currentDay.value || props.modelValue)
|
||||||
momentVal = momentObj.format(fmtMap[props.type])
|
momentVal = momentObj.format(fmtMap[props.type])
|
||||||
if (momentVal != props.modelValue)
|
if (momentVal != props.modelValue)
|
||||||
$emits("update:modelValue", momentVal);
|
$emits("update:modelValue", momentVal);
|
||||||
|
Loading…
Reference in New Issue
Block a user