Доработки отображения в зависимости от config.mode
This commit is contained in:
@@ -6,7 +6,7 @@ const api = axios.create({
|
||||
|
||||
class Misc {
|
||||
async loadConfig() {
|
||||
const response = await api.post('/config', {params: ['name', 'version']});
|
||||
const response = await api.post('/config', {params: ['name', 'version', 'mode']});
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-aside :width="asideWidth">
|
||||
<el-aside v-if="showAsideBar" :width="asideWidth">
|
||||
<div class="app-name"><span v-html="appName"></span></div>
|
||||
<el-button class="el-button-collapse" @click="toggleCollapse" :icon="buttonCollapseIcon"></el-button>
|
||||
<el-menu class="el-menu-vertical" :default-active="rootRoute" :collapse="isCollapse" router>
|
||||
@@ -35,7 +35,7 @@
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
|
||||
<el-main>
|
||||
<el-main v-if="showMain">
|
||||
<keep-alive>
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
@@ -49,6 +49,14 @@ import Vue from 'vue';
|
||||
import Component from 'vue-class-component';
|
||||
|
||||
export default @Component({
|
||||
watch: {
|
||||
rootRoute: function(newValue, oldValue) {
|
||||
if ((this.mode == 'reader' || this.mode == 'omnireader') && (newValue != '/reader')) {
|
||||
this.$router.replace('/reader');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
})
|
||||
class App extends Vue {
|
||||
created() {
|
||||
@@ -115,6 +123,18 @@ class App extends Vue {
|
||||
itemTitleClass(path) {
|
||||
return (this.rootRoute == path ? {'bold-font': true} : {});
|
||||
}
|
||||
|
||||
get mode() {
|
||||
return this.config.mode;
|
||||
}
|
||||
|
||||
get showAsideBar() {
|
||||
return (this.mode != 'reader' && this.mode != 'omnireader');
|
||||
}
|
||||
|
||||
get showMain() {
|
||||
return (this.showAsideBar || this.rootRoute == '/reader');
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
</script>
|
||||
|
||||
@@ -33,7 +33,7 @@ const myRoutes = [
|
||||
['/sources', Sources ],
|
||||
['/settings', Settings ],
|
||||
['/help', Help ],
|
||||
['*', NotFound404 ],
|
||||
['*', null, null, '/cardindex' ],
|
||||
];
|
||||
|
||||
let routes = {};
|
||||
|
||||
Reference in New Issue
Block a user