From b804ee8520ea800203b9e24ba02c8d7f1021586f Mon Sep 17 00:00:00 2001 From: fanxb Date: Sat, 14 Dec 2019 00:20:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:chrome=E6=8F=92=E4=BB=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 浏览器插件/bookmark-chrome/src/popup/popup.js | 1 + .../src/popup/router/pages/Index.vue | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/浏览器插件/bookmark-chrome/src/popup/popup.js b/浏览器插件/bookmark-chrome/src/popup/popup.js index 7ed5591..71cca1b 100644 --- a/浏览器插件/bookmark-chrome/src/popup/popup.js +++ b/浏览器插件/bookmark-chrome/src/popup/popup.js @@ -33,6 +33,7 @@ axios.interceptors.request.use( axios.interceptors.response.use( res => { if (res.data.code === -1) { + localStorage.removeItem('token'); window.vueInstance.$router.replace('/public/login'); } else if (res.data.code === 1) { return res.data.data; diff --git a/浏览器插件/bookmark-chrome/src/popup/router/pages/Index.vue b/浏览器插件/bookmark-chrome/src/popup/router/pages/Index.vue index 33c0e24..cf97b34 100644 --- a/浏览器插件/bookmark-chrome/src/popup/router/pages/Index.vue +++ b/浏览器插件/bookmark-chrome/src/popup/router/pages/Index.vue @@ -2,7 +2,7 @@
icon - {{personInfo.username}} + {{ personInfo.username }}
@@ -22,14 +24,14 @@ export default { data() { return { personInfo: {}, - searchContent: "", + searchContent: '', searchList: [], - timeOut: null + timeOut: null, }; }, watch: { searchContent(newVal, oldVal) { - if (newVal.trim() != oldVal) { + if (newVal.trim() !== oldVal) { if (this.timeOut != null) { clearTimeout(this.timeOut); } @@ -39,7 +41,7 @@ export default { this.timeOut = null; }, 200); } - } + }, }, created() { window.token = localStorage.getItem('token'); @@ -47,11 +49,11 @@ export default { }, methods: { async init() { - let personInfo = await axios.get("/user/currentUserInfo"); + let personInfo = await axios.get('/user/currentUserInfo'); window.personInfo = personInfo; this.personInfo = personInfo; - } - } + }, + }, };