vue 引用vant中的swipe出不来

新手上路,请多包涵

实际的效果:image.png
想要的效果:image.png

代码如下:

<template>
  <van-swipe class="my-swipe" :autoplay="3000" lazy-render indicator-color="#1baeae">
    <van-swipe-item v-for="(image,index) in images" :key="index">
      <img :src="image" />
    </van-swipe-item>
  </van-swipe>
</template>

<script>
export default {
  setup() {
    const images = [
      'https://img.yzcdn.cn/vant/apple-1.jpg',
      'https://img.yzcdn.cn/vant/apple-2.jpg',
    ];
    return { images };
  }
}
</script>

<style lang="less" scoped>
  .my-swipe{
      img{
        width: 100%;
        height: 100%;
      }
    }
</style>

哪个大佬能帮忙解决!

阅读 3.8k
1 个回答

引入了嘛
import Vue from 'vue';
import { Swipe, SwipeItem } from 'vant';

Vue.use(Swipe);
Vue.use(SwipeItem);

推荐问题