vue+vue-fullpage實現(xiàn)整屏滾動頁面的示例代碼(直播平臺源碼)
直播平臺源碼,vue+vue-fullpage實現(xiàn)整屏滾動頁面
一、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) /* eslint-disable no-new */ 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中的方法 即回調(diào)函數(shù) scrollOverflow: true, scrollBar: false, menu: "#menu", sectionsColor: [ "#23A84A", "#ff5f45", "#0798ec", "#fec401", "#000000", "#E7EFFE", ], }, }; }, }
三、常用API
1.afterLoad:對應(yīng)的函數(shù)寫在methods中,常用作對頁面的處理
methods:{ afterLoad: function (origin, destination, direction) { // origin 起點 destination終點 direction方向 固定寫法 this.navIndex = destination.index; //destination.index代表對應(yīng)頁面index(從0開始) //拿到對應(yīng)頁面的index就可以進行操作 if (destination.index > 0) { this.phoneShow = true; } if (destination.index === 0) { this.phoneShow = false; } }, }
2.moveTo通過事件跳轉(zhuǎn)到對應(yīng)的page頁面
options: { afterLoad: this.afterLoad, //一定要在options中插入這段數(shù)組,數(shù)組的值對應(yīng)page頁面 anchors: ["page1", "page2", "page3", "page4", "page5", "page6"], licenseKey: "OPEN-SOURCE-GPLV3-LICENSE", afterLoad: this.afterLoad, // method中的方法 即回調(diào)函數(shù) scrollOverflow: true, scrollBar: false, menu: "#menu", sectionsColor: [ "#23A84A", "#ff5f45", "#0798ec", "#fec401", "#000000", "#E7EFFE", ], }, moveTo(pages) { //固定寫法,第一個參數(shù)代表options中anchors數(shù)組中的值 //在點擊時傳遞對應(yīng)的pages值即可 fullpage_api.moveTo(pages, 1); },
到此這篇關(guān)于vue+vue-fullpage實現(xiàn)整屏滾動頁面的文章就介紹到這了,更多相關(guān)vue整屏滾動頁面內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
關(guān)于Vue中的計算屬性和監(jiān)聽屬性詳解
這篇文章主要介紹了關(guān)于Vue中的計算屬性和監(jiān)聽屬性詳解,Vue.js模板內(nèi)的表達式非常便利,但是設(shè)計它們的初衷是用于簡單運算的,在模板內(nèi)放入過長的或復(fù)雜的邏輯時,會讓模板過重且難以維護,需要的朋友可以參考下2023-05-05element的el-tree多選樹(復(fù)選框)父子節(jié)點關(guān)聯(lián)不關(guān)聯(lián)
最近想要實現(xiàn)多選框關(guān)聯(lián)的功能,但是卻出現(xiàn)了element的el-tree多選樹(復(fù)選框)父子節(jié)點關(guān)聯(lián)不關(guān)聯(lián)的問題,本文就來介紹一下解決方法,一起來了解一下2021-05-05vue實現(xiàn)點擊某個div顯示與隱藏內(nèi)容功能實例
最近做項目有用到某個div顯示與隱藏內(nèi)容,所以下面這篇文章主要給大家介紹了關(guān)于vue實現(xiàn)點擊某個div顯示與隱藏內(nèi)容功能的相關(guān)資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2022-12-12vue封裝可復(fù)用組件confirm,并綁定在vue原型上的示例
今天小編就為大家分享一篇vue封裝可復(fù)用組件confirm,并綁定在vue原型上的示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-10-10Vue3中使用Element?Plus時el-icon無法顯示的問題解決
我們的Vue前端一般都是用的ElementUI,其中按鈕可能用到的比較多,官方里面有自帶的一些默認圖標,下面這篇文章主要給大家介紹了關(guān)于Vue3中使用Element?Plus時el-icon無法顯示的問題解決,需要的朋友可以參考下2022-03-03