yxbanner

功能描述

该模块封装了app首页常用的banner图调用

依赖模块

vant、swiper、vue

快速使用

  1. <link rel="stylesheet" type="text/css" href="libs/vant/vant.min.css" />
  2. <link rel="stylesheet" type="text/css" href="libs/swiper/css/swiper.min.css" />
  3. <script type="text/javascript" src="libs/vue/vue.js"></script>
  4. <script type="text/javascript" src="libs/vant/vant.min.js"></script>
  5. <script type="text/javascript" src="libs/swiper/js/swiper.min.js"></script>
  6. <div id="rootWrap" v-cloak>
  7. <!-- 轮播图 start -->
  8. <div class="floor1">
  9. <van-swipe :autoplay="autoTime" id="vant-banner">
  10. <van-swipe-item v-for="(item, index) in banner" :key="index">
  11. <img :src='item.image' alt="" @click="bannerJump(index)" class="bannerImg" />
  12. </van-swipe-item>
  13. </van-swipe>
  14. </div>
  15. <!-- 轮播图 end -->
  16. </div>
  17. function initVue() {
  18. 'use strict';
  19. window.rootVue = new Vue({
  20. el: '#rootWrap',
  21. data: {
  22. // 自动播放时间
  23. autoTime: 2000,
  24. banner: [{
  25. "image": "http://ryxy.oss-cn-beijing.aliyuncs.com/upload/20190819/s8sers0mt2hj2q8o73drk77ums.png",
  26. }, {
  27. "image": "http://ryxy.oss-cn-beijing.aliyuncs.com/upload/20190819/u29k9aialeh1srus6le2qooura.png",
  28. }, {
  29. "image": "http://ryxy.oss-cn-beijing.aliyuncs.com/upload/20190828/659hc3dlpqghgqgcksurh8kqu8.png",
  30. }],
  31. },
  32. created: function() {},
  33. methods: {},
  34. mounted: function() {
  35. },
  36. })
  37. }