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.7k
1 个回答

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

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题