diff --git a/src/App.vue b/src/App.vue index af2c698..fc2aa58 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,7 +12,7 @@ - + - diff --git a/src/views/anchor.vue b/src/views/anchor.vue index a45653e..b5d58f4 100644 --- a/src/views/anchor.vue +++ b/src/views/anchor.vue @@ -51,6 +51,18 @@ export default { document.onmousewheel = this.scrollFun; } }, + beforeDestroy() { //及时释放 + // 浏览器兼容 + if ((navigator.userAgent.toLowerCase().indexOf("firefox") != -1)) { + document.removeEventListener("DOMMouseScroll", this.scrollFun, false); + } else if (document.addEventListener) { + document.removeEventListener("mousewheel", this.scrollFun, false); + } else if (document.attachEvent) { + document.removeEventListener("onmousewheel", this.scrollFun); + } else { + document.onmousewheel = this.scrollFun; + } + }, methods: { scrollFun(event) { //console.log(this.main,this.page2.offsetTop,this.screenHeight) @@ -60,18 +72,19 @@ export default { let delta = event.detail || (-event.wheelDelta); console.log(delta) // 如果当前滚动开始时间和上次滚动结束时间的差值小于1.5s,则不执行翻页动作,这样做是为了实现类似节流的效果 - if ((this.startTime - this.endTime) > 1000) { - if (delta > 0 && window.pageYOffset < 937) { + if ((this.startTime - this.endTime) > 1) { + if (delta > 0 && window.pageYOffset < window.innerHeight) { // // 向下滚动 // this.index = 2; // this.toPage(this.index); - window.scrollTo({top: 937, behavior: 'smooth',}) - } else if (delta < 0 && parseInt(this.main.offsetTop) == 0) { + window.scrollTo({top: window.innerHeight+20, behavior: 'smooth',}) + } else if (delta < 0 && window.pageYOffset <= window.innerHeight+200) { // // 向上滚动 // // // // + window.scrollTo({top: 0, behavior: 'smooth',}) // this.index = 1; // this.toPage(this.index); } diff --git a/src/views/content/components/details.vue b/src/views/content/components/details.vue index e629a2a..5ad39cc 100644 --- a/src/views/content/components/details.vue +++ b/src/views/content/components/details.vue @@ -4,7 +4,13 @@
{{ value.title }}
-
测试
+
+ + 来源: {{getSource()}} + 作者:{{value.publishUserName}} + 日期:{{value.publishTime}} + 点击数:{{value.viewCount}} +
@@ -15,7 +21,7 @@