|
@@ -1,5 +1,11 @@
|
|
|
import { throttle } from "lodash";
|
|
|
export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ leftScrollTimeStamp: 0,
|
|
|
+ rightScrollTimeStamp: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
methods: {
|
|
|
registScrollEvent() {
|
|
|
document
|
|
@@ -21,7 +27,14 @@ export default {
|
|
|
this.paperScrollEvent(e);
|
|
|
}, 20),
|
|
|
paperScrollEvent(e) {
|
|
|
- console.log(2, e.target);
|
|
|
+ this.rightScrollTimeStamp = e.timeStamp;
|
|
|
+ if (
|
|
|
+ this.leftScrollTimeStamp > this.rightScrollTimeStamp ||
|
|
|
+ this.rightScrollTimeStamp - this.leftScrollTimeStamp < 15
|
|
|
+ ) {
|
|
|
+ //判断为用户是从左边触发滚动的
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (this.scrollType === "rich-text") {
|
|
|
this.lastPaperScrollTop =
|
|
|
document.getElementById("qe-part-paper").scrollTop;
|
|
@@ -95,7 +108,14 @@ export default {
|
|
|
this.richTextScrollEvent(e);
|
|
|
}, 20),
|
|
|
richTextScrollEvent(e) {
|
|
|
- console.log(1, e.target);
|
|
|
+ this.leftScrollTimeStamp = e.timeStamp;
|
|
|
+ if (
|
|
|
+ this.rightScrollTimeStamp > this.leftScrollTimeStamp ||
|
|
|
+ this.leftScrollTimeStamp - this.rightScrollTimeStamp < 15
|
|
|
+ ) {
|
|
|
+ //判断为用户是从右边触发滚动的
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (this.scrollType === "paper") {
|
|
|
this.lastRichTextScrollTop = document.getElementById(
|
|
|
"qe-part-richtext-list"
|
|
@@ -110,7 +130,6 @@ export default {
|
|
|
if (!this.$refs.QuestionImportPaperEdit) return;
|
|
|
|
|
|
const isScrollDown = e.target.scrollTop > this.lastRichTextScrollTop;
|
|
|
- // console.log(isScrollDown, e.target.scrollTop, this.lastRichTextScrollTop);
|
|
|
this.lastRichTextScrollTop = e.target.scrollTop;
|
|
|
const offsetH = isScrollDown ? 150 : 0;
|
|
|
const scrollTop = e.target.scrollTop + offsetH;
|