You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
936 B

3 years ago
import { getCurrentPage } from '../common/utils';
function onPageScroll(event) {
const {
vanPageScroller = []
} = getCurrentPage();
vanPageScroller.forEach(scroller => {
if (typeof scroller === 'function') {
// @ts-ignore
scroller(event);
}
});
}
module.exports = {
data() {
return {};
},
props: {},
beforeMount() {
const page = getCurrentPage();
if (Array.isArray(page.vanPageScroller)) {
page.vanPageScroller.push(scroller.bind(this));
} else {
page.vanPageScroller = typeof page.onPageScroll === 'function' ? [page.onPageScroll.bind(page), scroller.bind(this)] : [scroller.bind(this)];
}
page.onPageScroll = onPageScroll;
},
destroyed() {
var _a;
const page = getCurrentPage();
page.vanPageScroller = ((_a = page.vanPageScroller) === null || _a === void 0 ? void 0 : _a.filter(item => item !== scroller)) || [];
},
methods: {}
};