Skip to content

Commit

Permalink
fix(image): fix responsiveness problem
Browse files Browse the repository at this point in the history
fix #263
  • Loading branch information
TingShine authored and anlyyao committed Aug 15, 2022
1 parent b21b586 commit 6215f56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/image/image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</template>

<script lang="ts">
import { ref, computed, defineComponent, SetupContext, getCurrentInstance, h, watch } from 'vue';
import { ref, computed, defineComponent, SetupContext, getCurrentInstance, h, watchEffect } from 'vue';
import { useIntersectionObserver } from '@vueuse/core';
import { EllipsisIcon, CloseIcon } from 'tdesign-icons-vue-next';
import { useEmitEvent, renderTNode, TNode } from '../shared';
Expand Down Expand Up @@ -69,7 +69,10 @@ export default defineComponent({
// 图片懒加载
const imageDOM = ref();
const realSrc = ref(props.lazy ? '' : props.src);
const realSrc = ref('');
watchEffect(() => {
realSrc.value = props.lazy ? '' : props.src;
});
const { stop } = useIntersectionObserver(imageDOM, ([{ isIntersecting }], observerElement) => {
if (isIntersecting && props.lazy) {
// 停止监听
Expand Down

0 comments on commit 6215f56

Please sign in to comment.