This commit is contained in:
syuilo
2018-06-08 05:48:27 +09:00
parent af9c5c6ab7
commit af501f5eeb
5 changed files with 71 additions and 31 deletions

View File

@ -1,11 +1,11 @@
<template>
<div class="dnpfarvgbnfmyzbdquhhzyxcmstpdqzs" :class="{ naked, narrow, isActive, isStacked }">
<div class="dnpfarvgbnfmyzbdquhhzyxcmstpdqzs" :class="{ naked, narrow, active, isStacked }">
<header :class="{ indicate: count > 0 }" @click="toggleActive">
<slot name="header"></slot>
<span class="count" v-if="count > 0">({{ count }})</span>
<button ref="menu" @click.stop="showMenu">%fa:caret-down%</button>
</header>
<div ref="body" v-show="isActive">
<div ref="body" v-show="active">
<slot></slot>
</div>
</div>
@ -17,6 +17,18 @@ import Menu from '../../../../common/views/components/menu.vue';
export default Vue.extend({
props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
},
isActive: {
type: Boolean,
required: true
},
name: {
type: String,
required: false
@ -39,21 +51,18 @@ export default Vue.extend({
},
inject: {
column: { from: 'column' },
_isActive: { from: 'isActive' },
isStacked: { from: 'isStacked' },
getColumnVm: { from: 'getColumnVm' }
},
data() {
return {
count: 0,
isActive: this._isActive
active: this.isActive
};
},
watch: {
isActive(v) {
active(v) {
if (v && this.isScrollTop()) {
this.$emit('top');
}
@ -79,12 +88,12 @@ export default Vue.extend({
toggleActive() {
if (!this.isStacked) return;
const vms = this.$store.state.settings.deck.layout.find(ids => ids.indexOf(this.column.id) != -1).map(id => this.getColumnVm(id));
if (this.isActive && vms.filter(vm => vm.$el.classList.contains('isActive')).length == 1) return;
this.isActive = !this.isActive;
if (this.active && vms.filter(vm => vm.$el.classList.contains('active')).length == 1) return;
this.active = !this.active;
},
isScrollTop() {
return this.isActive && this.$refs.body.scrollTop == 0;
return this.active && this.$refs.body.scrollTop == 0;
},
onScroll() {
@ -176,7 +185,7 @@ root(isDark)
box-shadow 0 2px 16px rgba(#000, 0.1)
overflow hidden
&:not(.isActive)
&:not(.active)
flex-basis $header-height
min-height $header-height