Skip to content

Commit

Permalink
滚动监听C
Browse files Browse the repository at this point in the history
  • Loading branch information
FinGet committed Apr 27, 2018
1 parent 4328431 commit 9f43fe7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/exam/pages/exam.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,10 @@
this.id = this.$route.params.id;
// this.startTime = new Date();
this.init();
if(this.$refs.submitBox){
window.onscroll=() => {
this.scroll = document.body.scrollTop;
if(this.scroll>250) {
this.$refs.submitBox.style.top=10+'px';
} else {
this.$refs.submitBox.style.top=250+'px';
}
}
}
window.addEventListener('scroll', this.handleScroll);
},
beforeDestroy(){
// alert(1);
// this.dialogVisible = true;
window.removeEventListener('scroll', this.handleScroll);
},
methods:{
/**
Expand Down Expand Up @@ -222,6 +212,14 @@
}, 1000)
}
},
handleScroll(){
this.scroll = document.body.scrollTop;
if(this.scroll>250) {
this.$refs.submitBox.style.top=10+'px';
} else {
this.$refs.submitBox.style.top=250+'px';
}
},
/**
* 提交试卷
* @return {[type]} [description]
Expand Down

0 comments on commit 9f43fe7

Please sign in to comment.