123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <div class="main">
- <pre>{{ meta }}</pre>
- </div>
- </template>
- <script>
- //-----------------------------------------------------------------------------
- import Vue from 'vue';
- import Component from 'vue-class-component';
- import _ from 'lodash';
- import bookManager from '../share/bookManager';
- export default @Component({
- })
- class TextPage extends Vue {
- meta = null;
- fb2 = null;
- created() {
- this.commit = this.$store.commit;
- this.dispatch = this.$store.dispatch;
- this.config = this.$store.state.config;
- this.reader = this.$store.state.reader;
- this.openFailed = false;
- }
- activated() {
- this.book = null;
- this.meta = null;
- this.fb2 = null;
- const last = this.lastOpenedBook;
- if (last) {
- (async() => {
- const isParsed = await bookManager.hasBookParsed(last);
- if (!isParsed) {
- this.$root.$emit('set-app-title');
- if (!this.openFailed) {
- this.$emit('parse-book', last);
- this.openFailed = true;
- }
- return;
- }
- this.book = await bookManager.getBook(last);
- this.meta = bookManager.metaOnly(this.book);
- this.fb2 = this.meta.fb2;
- this.$root.$emit('set-app-title', _.compact([
- this.fb2.lastName,
- this.fb2.middleName,
- this.fb2.firstName,
- '-',
- this.fb2.bookTitle
- ]).join(' '));
- })();
- }
- }
- get lastOpenedBook() {
- return this.$store.getters['reader/lastOpenedBook'];
- }
- showPage() {
- if (!this.book)
- return;
- }
- keyHook(event) {
- }
- }
- //-----------------------------------------------------------------------------
- </script>
- <style scoped>
- .main {
- flex: 1;
- display: flex;
- flex-direction: column;
- }
- p {
- margin: 0;
- padding: 0;
- text-indent: 3%;
- }
- </style>
|