|
@@ -1,7 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div class="main">
|
|
<div class="main">
|
|
- <pre>{{ lastOpenedBook }}</pre>
|
|
|
|
- <pre>{{this.$store.state.reader.openedBook}}</pre>
|
|
|
|
|
|
+ <pre>{{ parsedBook }}</pre>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -14,11 +13,30 @@ import bookManager from '../share/bookManager';
|
|
export default @Component({
|
|
export default @Component({
|
|
})
|
|
})
|
|
class TextPage extends Vue {
|
|
class TextPage extends Vue {
|
|
|
|
+ parsedBook = null;
|
|
|
|
+
|
|
created() {
|
|
created() {
|
|
this.commit = this.$store.commit;
|
|
this.commit = this.$store.commit;
|
|
this.dispatch = this.$store.dispatch;
|
|
this.dispatch = this.$store.dispatch;
|
|
this.config = this.$store.state.config;
|
|
this.config = this.$store.state.config;
|
|
this.reader = this.$store.state.reader;
|
|
this.reader = this.$store.state.reader;
|
|
|
|
+
|
|
|
|
+ this.book = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ activated() {
|
|
|
|
+ const last = this.lastOpenedBook;
|
|
|
|
+ if (last) {
|
|
|
|
+ (async() => {
|
|
|
|
+ const isParsed = await bookManager.hasBookParsed(last);
|
|
|
|
+ if (!isParsed) {
|
|
|
|
+ this.$emit('parse-book', last);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const book = await bookManager.getBook(last);
|
|
|
|
+ this.book = book.parsed;
|
|
|
|
+ })();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
get lastOpenedBook() {
|
|
get lastOpenedBook() {
|