From a9fff6b6de758928e29694b1d6dd684bfd574200 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Mon, 11 Feb 2019 17:47:50 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2,=20=D1=80=D0=B5=D1=84?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/App.vue | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/client/components/App.vue b/client/components/App.vue index 3624d66c..909cf607 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -50,19 +50,13 @@ import Component from 'vue-class-component'; export default @Component({ watch: { - rootRoute: function(newValue) { + rootRoute: function() { this.setAppTitle(); - if ((this.mode == 'reader' || this.mode == 'omnireader') && (newValue != '/reader')) { - //старый url - const search = window.location.search.substr(1); - const url = search.split('url=')[1] || ''; - if (url) { - window.location = `/#/reader?url=${url}`; - } else { - this.$router.replace('/reader'); - } - } + this.redirectIfNeeded(); }, + mode: function() { + this.redirectIfNeeded(); + } }, }) @@ -188,7 +182,7 @@ class App extends Vue { } get mode() { - return this.config.mode; + return this.$store.state.config.mode; } get showAsideBar() { @@ -202,6 +196,19 @@ class App extends Vue { get showMain() { return (this.showAsideBar || this.isReaderActive); } + + redirectIfNeeded() { + if ((this.mode == 'reader' || this.mode == 'omnireader') && (this.rootRoute != '/reader')) { + //старый url + const search = window.location.search.substr(1); + const url = search.split('url=')[1] || ''; + if (url) { + window.location = `/#/reader?url=${url}`; + } else { + this.$router.replace('/reader'); + } + } + } } //-----------------------------------------------------------------------------