Swipe image not displayed
请认真写 PR 的标题,会用于生成 change log。
Do you want to request a feature or report a bug?
What is the current behavior? Swipe image not displayed
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/n879nke7/). I am trying out the swipe demo.
- installed vue webpack template
- installed vant according to the doc
- installed babel-plugin-import and updated .babelrc
- created a component and copied demo code
<template>
<van-swipe auto-play @pagechange:end="handlePageEnd">
<van-swipe-item v-for="(img, index) in autoImages" :key="index">
<img v-lazy="img" alt="">
</van-swipe-item>
</van-swipe>
</template>
<script>
import { Swipe } from 'vant';
import { SwipeItem } from 'vant';
import 'vant/lib/vant-css/swipe.css';
export default {
name: 'swipe',
components: {
'van-swipe': Swipe,
'van-swipe-item': SwipeItem
},
data() {
return {
autoImages: [
'https://img.yzcdn.cn/upload_files/2017/03/09/FvkZahKoq1vkxLQFdVWeLf2UCqDz.png',
'https://img.yzcdn.cn/upload_files/2017/03/09/Fk0rpe_svu9d5Xk3MUCWd1QeMXOu.png'
]
}
},
methods: {
handlePageEnd(page, index) {
console.log(page, index);
}
}
}
</script>
<style>
</style>
- import vue and Lazyload in main.js
In Chrome dev-tool the code looks good and I can see the element move across the screen. however, the image itself does not show. Please see a screenshot below:

What is the expected behavior? It should behave like the demo (https://www.youzanyun.com/zanui/vue/examples/component/swipe)
Which versions of Vant and Vue, and which browser / OS are affected by this issue? Did this work in previous versions of Vant? vue: 2.8.2 vant: 0.8.4 OS: Mac OSX Browser: chrome
Found the problem: the height of van-swipe needs to be set explicitly. it works properly after setting the eight to 200px.