shortcut.js
615 Bytes
import event from '../../common/event';
Component({
properties: {
gototop: {
type: Boolean
}
},
data: {
hidden: true
},
attached() {
event.on('pageScroll', data => {
const {scrollTop} = data;
const change = scrollTop > 600;
if (this.data.hidden === change) {
this.setData({
hidden: !this.data.hidden
});
}
});
event.on('gototop', () => {
this.setData({
hidden: true
});
});
}
});