🐛(component): 修复datePicker构建之后time选择器错误
This commit is contained in:
parent
a037f53eb7
commit
7a9d948c12
@ -23,7 +23,7 @@
|
|||||||
:key="it"
|
:key="it"
|
||||||
:class="[
|
:class="[
|
||||||
'num',
|
'num',
|
||||||
index.toString().padStart(2, '0') == (hms as hmsType)[item.type]
|
index == hms[item.type]
|
||||||
? 'layui-this'
|
? 'layui-this'
|
||||||
: '',
|
: '',
|
||||||
]"
|
]"
|
||||||
@ -64,6 +64,7 @@ export interface hmsType {
|
|||||||
hh: number;
|
hh: number;
|
||||||
mm: number;
|
mm: number;
|
||||||
ss: number;
|
ss: number;
|
||||||
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
export interface TimePanelProps {
|
export interface TimePanelProps {
|
||||||
modelValue: hmsType;
|
modelValue: hmsType;
|
||||||
@ -77,7 +78,11 @@ const els = [
|
|||||||
{ count: 60, type: "mm" },
|
{ count: 60, type: "mm" },
|
||||||
{ count: 60, type: "ss" },
|
{ count: 60, type: "ss" },
|
||||||
];
|
];
|
||||||
const hms = ref<{ hh: number; mm: number; ss: number }>(props.modelValue);
|
const hms = ref<hmsType>({
|
||||||
|
hh:props.modelValue.hh,
|
||||||
|
mm: props.modelValue.mm,
|
||||||
|
ss: props.modelValue.ss,
|
||||||
|
});
|
||||||
|
|
||||||
// 点击时间 - hms
|
// 点击时间 - hms
|
||||||
const chooseTime = (e: any) => {
|
const chooseTime = (e: any) => {
|
||||||
@ -94,9 +99,13 @@ onMounted(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
() => {
|
() => {
|
||||||
hms.value = props.modelValue;
|
hms.value = {
|
||||||
|
hh:props.modelValue.hh,
|
||||||
|
mm: props.modelValue.mm,
|
||||||
|
ss: props.modelValue.ss
|
||||||
|
};
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true}
|
||||||
);
|
);
|
||||||
const scrollTo = () => {
|
const scrollTo = () => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@ -125,7 +134,7 @@ const scrollTo = () => {
|
|||||||
|
|
||||||
//确认关闭回调
|
//确认关闭回调
|
||||||
const footOnOk = () => {
|
const footOnOk = () => {
|
||||||
emits("update:modelValue", hms);
|
emits("update:modelValue", hms.value);
|
||||||
if (datePicker.range) {
|
if (datePicker.range) {
|
||||||
//关闭菜单
|
//关闭菜单
|
||||||
emits("ok");
|
emits("ok");
|
||||||
|
@ -260,11 +260,7 @@ const getDateValueByRange = () => {
|
|||||||
// 确认事件
|
// 确认事件
|
||||||
const ok = () => {
|
const ok = () => {
|
||||||
if (!props.range) {
|
if (!props.range) {
|
||||||
if (props.type === "time") {
|
getDateValue();
|
||||||
getDateValue();
|
|
||||||
} else {
|
|
||||||
getDateValue();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
getDateValueByRange();
|
getDateValueByRange();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user