|
|
export default {
|
|
|
deactivated() {
|
|
|
this.preVisibleEls = null;
|
|
|
},
|
|
|
methods: {
|
|
|
isVisible(offsetInfo, viewInfo, ratio = 0.5) {
|
|
|
return !((offsetInfo.offsetTop + offsetInfo.offsetHeight * (1 - ratio)) < viewInfo.top ||
|
...
|
...
|
@@ -7,7 +10,22 @@ export default { |
|
|
scrollEndHandler({y = this.$refs.pageScroll && this.$refs.pageScroll.$el.offsetTop} = {}) {
|
|
|
const scrollTop = Math.abs(y);
|
|
|
|
|
|
const pageScrollHeight = this.$refs.pageScroll.$el.offsetHeight;
|
|
|
let pageScrollHeight = this.$refs.pageScroll.$el.offsetHeight;
|
|
|
|
|
|
if (pageScrollHeight === 0) {
|
|
|
const app = document.querySelector('#app');
|
|
|
const header = document.querySelector('.layout-header');
|
|
|
const footer = document.querySelector('.footer');
|
|
|
|
|
|
pageScrollHeight = app && app.offsetHeight || window.innerHeight;
|
|
|
if (header) {
|
|
|
pageScrollHeight -= header.offsetHeight;
|
|
|
}
|
|
|
if (footer) {
|
|
|
pageScrollHeight -= footer.offsetHeight;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const viewInfo = {
|
|
|
top: scrollTop,
|
|
|
bottom: scrollTop + pageScrollHeight,
|
...
|
...
|
|