vant icon indicating copy to clipboard operation
vant copied to clipboard

Swipe image not displayed

Open oddonet opened this issue 9 years ago • 1 comments

请认真写 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.

  1. installed vue webpack template
  2. installed vant according to the doc
  3. installed babel-plugin-import and updated .babelrc
  4. 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>
  1. 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:

screenshot

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

oddonet avatar Aug 18 '17 14:08 oddonet

Found the problem: the height of van-swipe needs to be set explicitly. it works properly after setting the eight to 200px.

oddonet avatar Aug 18 '17 22:08 oddonet