Поправки багов, рефакторинг

This commit is contained in:
Book Pauk
2019-02-11 17:47:50 +07:00
parent 567564b5c4
commit a9fff6b6de

View File

@@ -50,19 +50,13 @@ import Component from 'vue-class-component';
export default @Component({ export default @Component({
watch: { watch: {
rootRoute: function(newValue) { rootRoute: function() {
this.setAppTitle(); this.setAppTitle();
if ((this.mode == 'reader' || this.mode == 'omnireader') && (newValue != '/reader')) { this.redirectIfNeeded();
//старый 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');
}
}
}, },
mode: function() {
this.redirectIfNeeded();
}
}, },
}) })
@@ -188,7 +182,7 @@ class App extends Vue {
} }
get mode() { get mode() {
return this.config.mode; return this.$store.state.config.mode;
} }
get showAsideBar() { get showAsideBar() {
@@ -202,6 +196,19 @@ class App extends Vue {
get showMain() { get showMain() {
return (this.showAsideBar || this.isReaderActive); 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');
}
}
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
</script> </script>