• vue使用swiper6分页器踩坑


    原因在于,在第六版导入只能导入swiper核心内容,而部分组件效果如分页器需要单独导入

    import Swiper, { Pagination, Navigation } from 'swiper'
    Swiper.use([Pagination, Navigation])

     自己写的有分页器和环路的轮播

    <template>
      <div class="warper">
        <swiper :options="swiperOptions">
          <swiper-slide v-for="item of swiperList" :key="item.id">
            <img class="swiper-img" :src="item.imgUrl" />
          </swiper-slide>
          <div class="swiper-pagination" slot="pagination"></div>
        </swiper>
      </div>
    </template>
    <script>
    export default {
      name: 'Homeswiper',
      data() {
        return {
          swiperOptions: {
            loop: true,
            pagination: {
              el: '.swiper-pagination'
            }
          },
          swiperList: [
            {
              id: '0001',
              imgUrl: require('../../public/images/swiper04.jpg')
            },
            {
              id: '0002',
              imgUrl: require('../../public/images/swiper03.jpg')
            },
            {
              id: '0003',
              imgUrl: require('../../public/images/swiper02.jpg')
            },
            {
              id: '0004',
              imgUrl: require('../../public/images/swiper01.jpg')
            },
            {
              id: '0005',
              imgUrl: require('../../public/images/城.jpg')
            }
          ]
        }
      },
      methods: {}
    }
    </script>
    <style lang="stylus" scoped>
    .warper >>> .swiper-pagination-bullet-active  //样式穿透
        background :#fff !important
    .warper
        width 100%
        height:45.5vw
        .swiper-img
            width 100%
            height 3.3rem
    </style>
  • 相关阅读:
    Python3 调用 Ansible2.x API
    Django——form组件和ModelForm
    Python super().__init__()测试及理解
    ORACLE迁移记录
    CentOS7安装zabbix5.0
    ORACLE LINUX 7.7 安装ORACLE 11.2.0.4.0 RAC
    Spring
    【Git】clone项目&push项目没反应,Cloning into...没下载
    样式不显示,静态资源路径错误
    日常Java练习题
  • 原文地址:https://www.cnblogs.com/vivin-echo/p/13887105.html
Copyright © 2020-2023  润新知