data() {
return {
options: {
afterLoad: this.afterLoad,
// 这个是回调函数
verticalCentered: false,
scrollingSpeed: 500,
navigation: 'true',
section: ['#fff', '#fff', '#fff', '#fff', '#fff']
},
topShow: false,
}
},
- methods部分
section滚动会造成body的刷新,同时调用回调函数,其中body上的classname,对应’fp-viewing-0’,‘fp-viewing-1’,‘fp-viewing-2’
```methods: {
//回调函数会随着section滑动调用
afterLoad() {
console.log("Emitted 'after load' event.")
//获取body的classname,跟随section滑动刷新
let a = document.body.className
//在第几页控制相关逻辑
if (a != 'fp-viewing-0') {
} else {
}
},
}