Compare commits

...

2 Commits

Author SHA1 Message Date
neverland
be2a401d23
fix(Image): failed to hide loading when using lazy-load (#10193) 2022-01-15 21:11:11 +08:00
neverland
6e27d02404
chore(ImagePreview): decrease tap offset (#10192) 2022-01-15 20:07:12 +08:00
2 changed files with 13 additions and 3 deletions

View File

@ -192,7 +192,7 @@ export default defineComponent({
const { offsetX, offsetY } = touch;
const deltaTime = Date.now() - touchStartTime;
const TAP_TIME = 250;
const TAP_OFFSET = 10;
const TAP_OFFSET = 5;
if (
offsetX.value < TAP_OFFSET &&

View File

@ -2,6 +2,7 @@ import {
ref,
watch,
computed,
nextTick,
onBeforeUnmount,
defineComponent,
getCurrentInstance,
@ -159,8 +160,17 @@ export default defineComponent({
};
const onLazyLoaded = ({ el }: { el: HTMLElement }) => {
if (el === imageRef.value && loading.value) {
onLoad();
const check = () => {
if (el === imageRef.value && loading.value) {
onLoad();
}
};
if (imageRef.value) {
check();
} else {
// LazyLoad may trigger loaded event before Image mounted
// https://github.com/youzan/vant/issues/10046
nextTick(check);
}
};