From 49e24daff3fc3535b65c8ad5636c72fa1e8a925a Mon Sep 17 00:00:00 2001 From: Logaxn <logaxn@foxmail.com> Date: Tue, 28 May 2019 11:24:27 +0800 Subject: [PATCH 1/2] make tab work with router smoother --- src/permission.js | 6 ++++++ src/views/tab/index.vue | 20 +++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/permission.js b/src/permission.js index 750aeab6..5b0a6ed4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -11,6 +11,12 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist router.beforeEach(async(to, from, next) => { + // skip some code, make tab work with router smoother + if (to.path === from.path) { + next() + return + } + // start progress bar NProgress.start() diff --git a/src/views/tab/index.vue b/src/views/tab/index.vue index 6438a47a..f07a99f9 100644 --- a/src/views/tab/index.vue +++ b/src/views/tab/index.vue @@ -26,20 +26,18 @@ export default { { label: 'Japan', key: 'JP' }, { label: 'Eurozone', key: 'EU' } ], - activeName: 'CN', createdTimes: 0 } }, - watch: { - activeName(val) { - this.$router.push(`${this.$route.path}?tab=${val}`) - } - }, - created() { - // init the default selected tab - const tab = this.$route.query.tab - if (tab) { - this.activeName = tab + computed: { + activeName: { + get() { + return this.$route.query.tab || 'CN' + }, + set(tab) { + // this.$router.push({ query: { tab }}) + this.$router.replace({ query: { tab }}) + } } }, methods: { From 8d225ade9dbc25086213a2c4355453bd6c987a07 Mon Sep 17 00:00:00 2001 From: outception <42709228+outception@users.noreply.github.com> Date: Sun, 14 Jul 2019 21:11:56 +0800 Subject: [PATCH 2/2] Node 12 support --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8fbbf88e..4a270109 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "husky": "1.3.1", "lint-staged": "8.1.5", "mockjs": "1.0.1-beta3", - "node-sass": "^4.9.0", + "node-sass": "^4.12.0", "plop": "2.3.0", "runjs": "^4.3.2", "sass-loader": "^7.1.0",