Добавил реакцию на роутер

This commit is contained in:
Book Pauk
2019-01-15 03:08:48 +07:00
parent 9c2a6da04c
commit 121d055419
2 changed files with 57 additions and 4 deletions

View File

@@ -82,6 +82,21 @@ class Reader extends Vue {
/*while (this.lastOpenedBook) {
this.commit('reader/delOpenedBook', this.lastOpenedBook);
}*/
if (this.$root.rootRoute == '/reader' && this.routeParamUrl && this.routeParamUrl != this.lastOpenedBook.url) {
this.commit('reader/setLoaderActive', true);
this.loadBook({url: this.routeParamUrl});
}
}
get routeParamUrl() {
let result = '';
const path = this.$route.fullPath;
const i = path.indexOf('url=');
if (i >= 0) {
result = path.substr(i + 4);
}
return decodeURIComponent(result);
}
get loaderActive() {
@@ -130,6 +145,11 @@ class Reader extends Vue {
if (result != 'TextPage') {
this.$root.$emit('set-app-title');
}
if (result == 'LoaderPage') {
this.$router.replace('/reader');
}
return result;
}