Переделки с отображением HistoryPage

This commit is contained in:
Book Pauk
2019-01-27 05:18:29 +07:00
parent e0d0c6e46c
commit 6ca7a9fff9
2 changed files with 20 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<div ref="main" class="main" @click="close"> <div ref="main" class="main" @click="close">
<div class="main" @click.stop> <div class="clickStop" @click.stop>
<Window @close="close"> <Window @close="close">
<template slot="header"> <template slot="header">
Последние 100 открытых книг Последние 100 открытых книг
@@ -197,12 +197,20 @@ class HistoryPage extends Vue {
<style scoped> <style scoped>
.main { .main {
flex: 1; position: absolute;
width: 100%;
height: 100%;
z-index: 50;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.clickStop {
height: 100%;
display: flex;
}
.header { .header {
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@@ -46,13 +46,14 @@
<el-main> <el-main>
<keep-alive> <keep-alive>
<component ref="page" :is="pageActive" <component ref="page" :is="activePage"
@load-book="loadBook" @load-book="loadBook"
@book-pos-changed="bookPosChanged" @book-pos-changed="bookPosChanged"
@tool-bar-toggle="toolBarToggle" @tool-bar-toggle="toolBarToggle"
@history-toggle="historyToggle"
></component> ></component>
</keep-alive> </keep-alive>
<HistoryPage v-if="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
@@ -78,7 +79,7 @@ export default @Component({
}, },
watch: { watch: {
bookPos: function(newValue) { bookPos: function(newValue) {
if (newValue !== undefined && this.pageActive == 'TextPage') { if (newValue !== undefined && this.activePage == 'TextPage') {
const textPage = this.$refs.page; const textPage = this.$refs.page;
if (textPage.bookPos != newValue) { if (textPage.bookPos != newValue) {
textPage.bookPos = newValue; textPage.bookPos = newValue;
@@ -246,15 +247,13 @@ class Reader extends Vue {
return {}; return {};
} }
get pageActive() { get activePage() {
let result = ''; let result = '';
if (this.progressActive) if (this.progressActive)
result = 'ProgressPage'; result = 'ProgressPage';
else if (this.loaderActive) else if (this.loaderActive)
result = 'LoaderPage'; result = 'LoaderPage';
else if (this.historyActive)
result = 'HistoryPage';
else if (this.lastOpenedBook) else if (this.lastOpenedBook)
result = 'TextPage'; result = 'TextPage';
@@ -379,6 +378,9 @@ class Reader extends Vue {
if (this.$refs.page && this.$refs.page.keyHook) if (this.$refs.page && this.$refs.page.keyHook)
handled = this.$refs.page.keyHook(event); handled = this.$refs.page.keyHook(event);
if (this.historyActive)
handled = this.$refs.historyPage.keyHook(event);
if (!handled && event.type == 'keydown') { if (!handled && event.type == 'keydown') {
switch (event.code) { switch (event.code) {
case 'Escape': case 'Escape':
@@ -418,6 +420,7 @@ class Reader extends Vue {
} }
.el-main { .el-main {
position: relative;
display: flex; display: flex;
padding: 0; padding: 0;
margin: 0; margin: 0;