浏览代码

Do not change progress bar when scrolling through posts on a thread

sbkwgh 6 年之前
父节点
当前提交
b7b4f7d039
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      frontend/src/main.js

+ 9 - 4
frontend/src/main.js

@@ -2,8 +2,6 @@ import NProgress from 'nprogress'
 import IO from 'socket.io-client'
 window.socket = IO()
 
-console.log(NProgress)
-
 socket.on('disconnect', () => {
 	socket.connect('http://localhost:3000', {
 		reconnection: true,
@@ -95,12 +93,19 @@ const router = new VueRouter({
 
 router.beforeEach((to, from, next) => {
 	router.app.$store.commit('set404Page', false)
-	NProgress.start()
+
+	//Do not change progress bar when scrolling through posts on a thread
+	if(
+		(to.name !== 'thread-post' && from.name !== 'thread-post') &&
+		(!to.params.id || to.params.id !== from.params.id)
+	) {
+		NProgress.start()
+	}
+	
 	next()
 })
 router.afterEach(() => {
 	NProgress.done()
-//	debugger
 })
 
 Vue.filter('formatDate', function (value, format = '', join = ' ') {