Рефакторинг

This commit is contained in:
Book Pauk
2019-01-25 23:59:00 +07:00
parent a82791b627
commit bcc5b27d1e
2 changed files with 59 additions and 27 deletions

View File

@@ -1,13 +1,14 @@
<template>
<div ref="main" class="main">
<div class="window">
<div class="header">
<span class="header-text">Прочитаные книги:</span>
</div>
<Window>
<template slot="header">
Прочитаные книги:
</template>
<div class="list">
Test
</div>
</div>
</Window>
</div>
</template>
@@ -16,11 +17,17 @@
import Vue from 'vue';
import Component from 'vue-class-component';
import Window from '../../share/Window.vue';
export default @Component({
components: {
Window,
},
})
class HistoryPage extends Vue {
created() {
this.commit = this.$store.commit;
this.reader = this.$store.state.reader;
}
}
@@ -35,28 +42,6 @@ class HistoryPage extends Vue {
align-items: center;
}
.window {
flex: 1;
display: flex;
flex-direction: column;
min-width: 200px;
max-width: 600px;
background-color: #f5f7fa;
margin: 10px;
border: 1px solid black;
box-shadow: 3px 3px 5px black;
}
.header {
display: flex;
align-items: center;
height: 40px;
}
.header-text {
margin-left: 10px;
}
.list {
flex: 1;
background-color: #ffffff;

View File

@@ -0,0 +1,47 @@
<template>
<div class="window">
<div class="header">
<span class="header-text"><slot name="header"></slot></span>
</div>
<slot></slot>
</div>
</template>
<script>
//-----------------------------------------------------------------------------
import Vue from 'vue';
import Component from 'vue-class-component';
export default @Component({
})
class Window extends Vue {
created() {
}
}
//-----------------------------------------------------------------------------
</script>
<style scoped>
.window {
flex: 1;
display: flex;
flex-direction: column;
min-width: 200px;
max-width: 600px;
background-color: #f5f7fa;
margin: 10px;
border: 1px solid black;
box-shadow: 3px 3px 5px black;
}
.header {
display: flex;
align-items: center;
height: 40px;
}
.header-text {
margin-left: 10px;
}
</style>