Compare commits

...

3 Commits

Author SHA1 Message Date
neverland
04494a450d
fix(Calendar): content disappeared when hiding (#10910)
* fix(Calendar): content disappeared when hiding

* chore: add comment

* chore: upd
2022-08-13 13:24:12 +08:00
neverland
e5cc32ca97
fix(Calendar): reading getFullYear error in some cases (#10909) 2022-08-13 12:03:07 +08:00
neverland
c3776877ca
fix(Calendar): fix reading getFullYear error (#10908) 2022-08-13 11:43:15 +08:00
2 changed files with 10 additions and 5 deletions

View File

@ -185,10 +185,6 @@ export default defineComponent({
const months: Date[] = [];
const cursor = new Date(props.minDate);
if (props.lazyRender && !props.show && props.poppable) {
return months;
}
cursor.setDate(1);
do {
@ -299,7 +295,9 @@ export default defineComponent({
props.type === 'single'
? (currentDate.value as Date)
: (currentDate.value as Date[])[0];
scrollToDate(targetDate);
if (isDate(targetDate)) {
scrollToDate(targetDate);
}
} else {
raf(onScroll);
}

View File

@ -1,5 +1,6 @@
import { useRect } from '@vant/use';
import { Ref, ref, onMounted, nextTick } from 'vue';
import { onPopupReopen } from './on-popup-reopen';
export const useHeight = (
element: Element | Ref<Element | undefined>,
@ -25,5 +26,11 @@ export const useHeight = (
}
});
// The result of useHeight might be 0 when the popup is hidden,
// so we need to reset the height when the popup is reopened.
// IntersectionObserver is a better solution, but it is not supported by legacy browsers.
// https://github.com/vant-ui/vant/issues/10628
onPopupReopen(() => nextTick(setHeight));
return height;
};