提交 d8bfa65c 作者: 方治民

fix: 修复 CacheImage 组件没有使用懒加载机制问题

上级 88b8c6a9
...@@ -34,11 +34,8 @@ ...@@ -34,11 +34,8 @@
}, },
}) })
const visibleSrc = ref() const visibleSrc = ref(props.src)
const hashCacheKey = ref() const hashCacheKey = ref()
onMounted(async () => {
await tryCache()
})
// 监听 src 变化 // 监听 src 变化
watch( watch(
...@@ -149,6 +146,7 @@ ...@@ -149,6 +146,7 @@
:background="props.background" :background="props.background"
:src="visibleSrc" :src="visibleSrc"
@error="onError" @error="onError"
@visible="tryCache"
> >
<slot></slot> <slot></slot>
</fui-lazyload> </fui-lazyload>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<script> <script>
export default { export default {
name: "fui-lazyload", name: "fui-lazyload",
emits: ['error', 'load', 'click'], emits: ['error', 'load', 'click', 'visible'],
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
options: { options: {
virtualHost: true virtualHost: true
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
this.visible = false; this.visible = false;
setTimeout(() => { setTimeout(() => {
this.visible = true; this.visible = true;
this.$emit('visible', {})
}, 500) }, 500)
}, },
endObserver() { endObserver() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论