这里需要用的是vue-fullpage插件

安装

  • npm install vue-fullpage --save
  • npm install animate.css --save

配置

在main.js需要引入该插件的css和js文件

  • import 'vue-fullpage/vue-fullpage.css'
  • import VueFullpage from 'vue-fullpage'
  • Vue.use(VueFullpage)

页面代码

在page-wp容器上加v-fullpage指令,v-fullpage的值是fullpage的配置 在page容器上加v-animate指令,v-animate的值是animate.css的动画效果

  • <template>
  • <div id="app">
  • <div class="fullpage-container">
  • <div class="fullpage-wp" v-fullpage="opts">
  • <div class="page-1 page">
  • <p class="part-1" v-animate="{value: 'bounceInLeft'}">vue-fullpage</p>
  • </div>
  • <div class="page-2 page">
  • <p class="part-2" v-animate="{value: 'bounceInRight'}">vue-fullpage</p>
  • </div>
  • <div class="page-3 page">
  • <p class="part-3" v-animate="{value: 'bounceInLeft', delay: 0}">vue-fullpage</p>
  • <p class="part-3" v-animate="{value: 'bounceInRight', delay: 600}">vue-fullpage</p>
  • <p class="part-3" v-animate="{value: 'zoomInDown', delay: 1200}">vue-fullpage</p>
  • </div>
  • </div>
  • </div>
  • </div>
  • </template>
  • <script>
  • export default {
  • name: 'App',
  • data () {
  • return {
  • opts: {
  • start: 0,
  • dir: 'v',
  • loop: false,
  • duration: 500,
  • stopPageScroll: true,
  • beforeChange: function (prev, next) {
  • console.log(prev,next)
  • },
  • afterChange: function (prev, next) {
  • console.log(prev,next)
  • }
  • }
  • }
  • }
  • }
  • </script>
  • <style>
  • *{
  • margin: 0;
  • padding: 0;
  • }
  • #app{
  • position: absolute;
  • top: 0;
  • bottom: 0;
  • left: 0;
  • width: 100%;
  • color:red;
  • }
  • .page-1{
  • background: rgba(0,0,0,0.8);
  • }
  • .page-2{
  • background: pink;
  • }
  • .page-3{
  • background: blueviolet;
  • }
  • .page-container {
  • position: absolute;
  • left: 0;
  • top: 0;
  • width: 100%;
  • height: 100%;
  • }
  • </style>

本文由 管理员 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

只有地板了

  1. sdeyaxynwj
    sdeyaxynwj

    多语种文献的引用彰显学术包容性。

添加新评论