轮播图无法切换

来源:7-4 Vue项目首页 - 首页轮播图

慕少0288913

2019-09-09

图片描述

//HomeSwiper.Vue
<template>
  <swiper :options="swiperOption">
    <!-- slides -->
    <swiper-slide>I'm Slide 1</swiper-slide>
    <swiper-slide>I'm Slide 2</swiper-slide>
    <swiper-slide>I'm Slide 3</swiper-slide>
    <swiper-slide>I'm Slide 4</swiper-slide>
    <swiper-slide>I'm Slide 5</swiper-slide>
    <swiper-slide>I'm Slide 6</swiper-slide>
    <swiper-slide>I'm Slide 7</swiper-slide>
    <!-- Optional controls -->
    <div class="swiper-pagination" slot="pagination"></div>
    <div class="swiper-button-prev" slot="button-prev"></div>
    <div class="swiper-button-next" slot="button-next"></div>
    <div class="swiper-scrollbar" slot="scrollbar"></div>
  </swiper>
</template>

<script>
export default {
  name: "HomeSwiper",
  data() {
    return {
      swiperOption: {}
    };
  }
};
</script>
//Home.Vue
<template>
  <div>
    <home-header></home-header>
    <home-swiper></home-swiper>
  </div>
</template>

<script>
import HomeHeader from "./components/Header";
import HomeSwiper from "./components/Swiper";
export default {
  components: { HomeHeader, HomeSwiper }
};
</script>
//main.js
import Vue from 'vue'
import App from './App'
import router from './router'
import fastClick from 'fastclick' //解决移动端300ms点击延迟
import VueAwesomeSwiper from 'vue-awesome-swiper' //引入轮播插件
import 'styles/reset.css'//引入样式初始化文件
import 'styles/border.css'//解决移动端1px边框问题
import 'styles/iconfont.css'//引入iconfont
import 'swiper/dist/css/swiper.css'
写回答

2回答

努力的小猪猪

2019-11-01

同学你解决了吗

0
2
慕娘5402457
回复
Dell
无法点击,也无法拖动,老师
2020-02-19
共2条回复

Dell

2019-09-09

你看下你swiper的版本号,是否和我的版本号一致

0
10
Dell
回复
慕娘5402457
bscroll 创建的时候,加一个click:true的参数
2020-02-22
共10条回复

Vue2.5-2.6-3.0开发去哪儿网App 零基础入门到实战

课程紧跟Vue3版本迭代,企业主流版本Vue2+Vue3全掌握

10675 学习 · 8191 问题

查看课程