美文网首页
移动端H5页面宣传页

移动端H5页面宣传页

作者: 大脸猫_2e21 | 来源:发表于2019-07-08 11:02 被阅读0次

vue-awesome-swiper github地址

//实现移动端h5动态页面
<template>
  <div class="hello-world" ref="start">
    <transition name="fade">
      <swiper id="swiperBox" v-bind:options="swiperOption" ref="mySwiper">
          <!-- 第一页 -->
          <swiper-slide class="swiper-slide1">
            <div class="page">
            第一页
            </div>
          </swiper-slide>
          <!-- 第二页 -->
          <swiper-slide class="swiper-slide2">
            <div class="page">
              第二页
            </div>
          </swiper-slide>
          <!-- 第三页 -->
          <swiper-slide class="swiper-slide3 bg">
            <div class="page page3">
             第三页
            </div>
          </swiper-slide>
      </swiper>
    </transition>
  </div>
</template>
<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
  components: {
    swiper,
    swiperSlide
  },
  data () {
      return {
        play_music: true,
        music_play: true, //播放音乐
        second_show: false,
        swiperOption: {
          // swiper configs 所有的配置同swiper官方api配置
          notNextTick: true,//notNextTick是一个组件自有属性,如果notNextTick设置为true,组件则不会通过NextTick来实例化swiper,也就意味着你可以在第一时间获取到swiper对象,假如你需要刚加载遍使用获取swiper对象来做什么事,那么这个属性一定要是true
          direction: 'vertical',//水平方向移动
          grabCursor: true,//鼠标覆盖Swiper时指针会变成手掌形状,拖动时指针会变成抓手形状
          setWrapperSize: true,//Swiper使用flexbox布局(display: flex),开启这个设定会在Wrapper上添加等于slides相加的宽或高,在对flexbox布局的支持不是很好的浏览器中可能需要用到。
          autoHeight: true,//自动高度。设置为true时,wrapper和container会随着当前slide的高度而发生变化
          slidesPerView: 1,//设置slider容器能够同时显示的slides数量(carousel模式)。可以设置为数字(可为小数,小数不可loop),或者 'auto'则自动根据slides的宽度来设定数量。loop模式下如果设置为'auto'还需要设置另外一个参数loopedSlides。
          mousewheel: true,//开启鼠标滚轮控制Swiper切换。可设置鼠标选项,默认值false
          mousewheelControl: true,//同上
          height: window.innerHeight, // 高度设置,占满设备高度
          resistanceRatio: 0,//抵抗率。边缘抵抗力的大小比例。值越小抵抗越大越难将slide拖离边缘,0时完全无法拖离。本业务需要
          observeParents: true,//将observe应用于Swiper的父元素。当Swiper的父元素变化时,例如window.resize,Swiper更新
          // 如果自行设计了插件,那么插件的一些配置相关参数,也应该出现在这个对象中,如下debugger
          debugger: true,
          // swiper的各种回调函数也可以出现在这个对象中,和swiper官方一样
          onTransitionStart(swiper){
            // console.log(swiper)
          },
          on: {
          init: function () {
            swiperAni.swiperAnimateCache(this)
            swiperAni.swiperAnimate(this)
          },
          slideChange: function () {
            swiperAni.swiperAnimate(this)
          }
        }
      },
    }
  },
}
</script>
<style scoped>
.fade-enter-active, .fade-leave-active {
    transition: opacity .5s
  }
  .fade-enter, .fade-leave-to{
    opacity: 0
  }
//由于想要实现翻到哪页就播放哪页的动画,一开始使用的是swiper动画,但是不生效。
//由于翻到对应页面 对应页面就会有一个类名.swiper-slide-active被激活,然后就使用swiper这个特性,实现了滑动到哪页,哪页就播放动画。
//格式大概是这样的:
.swiper-slide-active{
  .page1{
    .logo1{
      // animation: 2s ease-in-out blink infinite;
      // animation: 1s ease-in-out slideInRight;
      // animation: 3s linear fadeIn infinite;
    }
    .slogan1{
      animation: 1s ease-in-out flip;
    }
    .time{
      // animation: 1s linear fadeIn;
    }
    .address{
      // animation: 2s linear fadeIn;
    }
}
</style>

相关文章

  • h5页面宣传有什么作用

    当下H5几乎成为了移动端宣传的主流方式,不管是商业活动还是品牌推广宣传,大多都会选择制作h5页面来进行相应的宣传工...

  • 移动端web页面适配

    移动端Web页面,即常说的H5页面、手机页面、webview页面等。 手机设备屏幕尺寸不一,在做移动端的Web页面...

  • 移动端H5页面宣传页

    vue-awesome-swiper github地址

  • 如何拯救你的H5?移动端常见问题集锦,小白免入

    H5页面在移动端无法满屏自适应窗口,怎么办? H5页面在移动端字体应该怎么设置? 1.iOS 系统默认中文字体是H...

  • 移动端如何适配?

    1、使用Flexible实现手淘H5页面的终端适配2、再聊移动端页面的适配3、如何在Vue项目中使用vw实现移动端...

  • 2018-10-16移动设备兼容性

    移动设备h5 web网站手机H5页面的区别 分辨率不同,web端为宽屏,手机端为窄平移动设备兼容测试的问题 买手机...

  • Android软键盘弹出,覆盖h5页面输入框问题

    ###Android软键盘弹出,覆盖h5页面输入框问题 开发移动端h5表单录入页面的过程中,遇到了Android软...

  • h5页面传播的成功基础

    如今在移动端集聚着大量的用户,这就成了大量企业商家的营销阵地,通过制作h5页面进行宣传,树立品牌,增加知名度几乎是...

  • H5兼容性问题

    记录H5页面各种兼容性问题汇总1、h5页面点击事件ios没反应 移动端兼容性问题 解决办法:给触发点击事件动态添加...

  • H5交互规范

    移动端的H5页面,实际上是基于移动端特性适配的网页,它没有规定的具体的交互规范,但会遵循一些移动端使用的基本特性。...

网友评论

      本文标题:移动端H5页面宣传页

      本文链接:https://www.haomeiwen.com/subject/ronjhctx.html