mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
fix(components): lazy image is not work when it changes src (#3189)
This commit is contained in:
parent
2f9cdc74ce
commit
c572d5e6e3
@ -301,12 +301,17 @@ export default defineComponent({
|
|||||||
emit('switch', val)
|
emit('switch', val)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(() => props.src, () => {
|
||||||
() => props.src,
|
if (props.lazy) {
|
||||||
() => {
|
// reset status
|
||||||
|
loading.value = true
|
||||||
|
hasLoadError.value = false
|
||||||
|
removeLazyLoadListener()
|
||||||
|
nextTick(addLazyLoadListener)
|
||||||
|
} else {
|
||||||
loadImage()
|
loadImage()
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.lazy) {
|
if (props.lazy) {
|
||||||
|
Loading…
Reference in New Issue
Block a user