vue+vue-fullpage實(shí)現(xiàn)整屏滾動(dòng)頁(yè)面的示例代碼(直播平臺(tái)源碼)
直播平臺(tái)源碼,vue+vue-fullpage實(shí)現(xiàn)整屏滾動(dòng)頁(yè)面
一、man.js引入
// An highlighted block
import router from './router'
Vue.config.productionTip = false
// 整屏滾動(dòng)
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:對(duì)應(yīng)的函數(shù)寫在methods中,常用作對(duì)頁(yè)面的處理
methods:{
afterLoad: function (origin, destination, direction) {
// origin 起點(diǎn) destination終點(diǎn) direction方向 固定寫法
this.navIndex = destination.index;
//destination.index代表對(duì)應(yīng)頁(yè)面index(從0開始)
//拿到對(duì)應(yīng)頁(yè)面的index就可以進(jìn)行操作
if (destination.index > 0) {
this.phoneShow = true;
}
if (destination.index === 0) {
this.phoneShow = false;
}
},
}2.moveTo通過(guò)事件跳轉(zhuǎn)到對(duì)應(yīng)的page頁(yè)面
options: {
afterLoad: this.afterLoad,
//一定要在options中插入這段數(shù)組,數(shù)組的值對(duì)應(yīng)page頁(yè)面
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) {
//固定寫法,第一個(gè)參數(shù)代表options中anchors數(shù)組中的值
//在點(diǎn)擊時(shí)傳遞對(duì)應(yīng)的pages值即可
fullpage_api.moveTo(pages, 1);
},到此這篇關(guān)于vue+vue-fullpage實(shí)現(xiàn)整屏滾動(dòng)頁(yè)面的文章就介紹到這了,更多相關(guān)vue整屏滾動(dòng)頁(yè)面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue.js+ElementUI實(shí)現(xiàn)進(jìn)度條提示密碼強(qiáng)度效果
這篇文章主要介紹了vue.js+ElementUI實(shí)現(xiàn)進(jìn)度條提示密碼強(qiáng)度效果,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-01-01
vue查詢數(shù)據(jù)el-table不更新數(shù)據(jù)的解決方案
這篇文章主要介紹了vue查詢數(shù)據(jù)el-table不更新數(shù)據(jù)的問(wèn)題及解決方案,本文通過(guò)示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-12-12
Vue3的provide和inject實(shí)現(xiàn)多級(jí)傳遞的原理解析
Vue3中的provide和inject函數(shù)通過(guò)原型鏈實(shí)現(xiàn)數(shù)據(jù)的多級(jí)傳遞,父組件使用provide注入數(shù)據(jù),子組件和后代組件通過(guò)inject獲取這些數(shù)據(jù),在創(chuàng)建組件實(shí)例時(shí),子組件會(huì)繼承父組件的provides屬性對(duì)象,介紹Vue3的provide和inject實(shí)現(xiàn)多級(jí)傳遞的原理,需要的朋友可以參考下2024-12-12
vue 解決移動(dòng)端彈出鍵盤導(dǎo)致頁(yè)面fixed布局錯(cuò)亂的問(wèn)題
今天小編就為大家分享一篇vue 解決移動(dòng)端彈出鍵盤導(dǎo)致頁(yè)面fixed布局錯(cuò)亂的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-11-11
vue3.0運(yùn)行npm run dev報(bào)錯(cuò)Cannot find module&
本文主要介紹了vue3.0運(yùn)行npm run dev報(bào)錯(cuò)Cannot find module node:url,因?yàn)槭褂玫膎ode版本是14.15.1低于15.0.0導(dǎo)致,具有一定的參考價(jià)值,感興趣的可以了解一下2023-10-10
vue創(chuàng)建項(xiàng)目卡住不動(dòng),vue?create?project卡住不動(dòng)的解決
這篇文章主要介紹了vue創(chuàng)建項(xiàng)目卡住不動(dòng),vue?create?project卡住不動(dòng)的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-10-10
Vue+Element-U實(shí)現(xiàn)分頁(yè)顯示效果
這篇文章主要為大家詳細(xì)介紹了Vue+Element-U實(shí)現(xiàn)分頁(yè)顯示效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-11-11

