iis服务器助手广告广告
返回顶部
首页 > 资讯 > 前端开发 > JavaScript >vue+vue-fullpage实现整屏滚动页面的示例代码(直播平台源码)
  • 230
分享到

vue+vue-fullpage实现整屏滚动页面的示例代码(直播平台源码)

2024-04-02 19:04:59 230人浏览 八月长安
摘要

目录一、man.js引入二、使用三、常用api直播平台源码,Vue+vue-fullpage实现整屏滚动页面 一、man.js引入 // An highlighted block i

直播平台源码Vue+vue-fullpage实现整屏滚动页面

一、man.js引入

// An highlighted block
import router from './router'
Vue.config.productionTip = false
// 整屏滚动
import 'fullpage.js/vendors/scrolloverflow';
import VueFullPage from 'vue-fullpage.js';
Vue.use(VueFullPage)

new Vue({
 el: '#app',
 router,
 components: { App },
 template: '<App/>'
})

二、使用

1.html

<template>
 <div>
  <full-page :options="options" id="fullpage" ref="fullpage">
   <div >
    <h3>vue-fullpage.js</h3>
   </div>
   <div >
    <div >
     <h3>Slide 2.1</h3>
    </div>
    <div >
     <h3>Slide 2.2</h3>
    </div>
    <div >
     <h3>Slide 2.3</h3>
    </div>
   </div>
   <div >
    <h3>Section 3</h3>
   </div>
  </full-page>
 </div>
</template>

2.js

export default {
 data() {
  return {
   options: {
    anchors: ["page1", "page2", "page3", "page4", "page5", "page6"],
    licenseKey: "OPEN-SOURCE-GPLV3-LICENSE",
    afterLoad: this.afterLoad, // method中的方法 即回调函数
    scrollOverflow: true,
    scrollBar: false,
    menu: "#menu",
    sectionsColor: [
     "#23A84A",
     "#ff5f45",
     "#0798ec",
     "#fec401",
     "#000000",
     "#E7EFFE",
    ],
   },
  };
 },
}

三、常用API

1.afterLoad:对应的函数写在methods中,常用作对页面的处理

methods:{
afterLoad: function (origin, destination, direction) {
    // origin 起点 destination终点 direction方向 固定写法
   this.navIndex = destination.index;
   //destination.index代表对应页面index(从0开始)
   //拿到对应页面的index就可以进行操作
   if (destination.index > 0) {
    this.phoneShow = true;
   }
   if (destination.index === 0) {
    this.phoneShow = false;
   }
  },
}

2.moveTo通过事件跳转到对应的page页面

 options: {
    afterLoad: this.afterLoad,
    //一定要在options中插入这段数组,数组的值对应page页面
    anchors: ["page1", "page2", "page3", "page4", "page5", "page6"],
    licenseKey: "OPEN-SOURCE-GPLV3-LICENSE",
    afterLoad: this.afterLoad, // method中的方法 即回调函数
    scrollOverflow: true,
    scrollBar: false,
    menu: "#menu",
    sectionsColor: [
     "#23A84A",
     "#ff5f45",
     "#0798ec",
     "#fec401",
     "#000000",
     "#E7EFFE",
    ],
   },
moveTo(pages) {
//固定写法,第一个参数代表options中anchors数组中的值
//在点击时传递对应的pages值即可
   fullpage_api.moveTo(pages, 1);
  },

到此这篇关于vue+vue-fullpage实现整屏滚动页面的文章就介绍到这了,更多相关vue整屏滚动页面内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!

--结束END--

本文标题: vue+vue-fullpage实现整屏滚动页面的示例代码(直播平台源码)

本文链接: https://www.lsjlt.com/news/153101.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作