mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 21:33:18 +01:00
* Settings in WIP * Updates some styles * Removes unused import * Adds version and switcher * Adds ionicons instead of fontawesome * Fixes ionicon for vuejs * Updates modules * Adds buefy * Adds search filter as settings * Adds localstorage * Fixes tests * Adds settings for menu width * Changes copy
90 lines
1.9 KiB
Vue
90 lines
1.9 KiB
Vue
<template lang="html">
|
|
<section>
|
|
<header v-if="$slots.header">
|
|
<slot name="header"></slot>
|
|
</header>
|
|
<main ref="content" @scroll.passive="onScroll" data-scrolling>
|
|
<slot></slot>
|
|
</main>
|
|
<div class="scroll-bar-notification">
|
|
<transition name="fade">
|
|
<button
|
|
class="button"
|
|
:class="hasMore ? 'is-warning' : 'is-primary'"
|
|
@click="scrollToBottom('smooth')"
|
|
v-show="paused"
|
|
>
|
|
<ion-icon name="download"></ion-icon>
|
|
</button>
|
|
</transition>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "ScrollableView",
|
|
data() {
|
|
return {
|
|
paused: false,
|
|
hasMore: false
|
|
};
|
|
},
|
|
mounted() {
|
|
const { content } = this.$refs;
|
|
new MutationObserver(e => {
|
|
if (!this.paused) {
|
|
this.scrollToBottom("instant");
|
|
} else {
|
|
this.hasMore = true;
|
|
}
|
|
}).observe(content, { childList: true, subtree: true });
|
|
},
|
|
|
|
methods: {
|
|
scrollToBottom(behavior = "instant") {
|
|
const { content } = this.$refs;
|
|
if (typeof content.scroll === "function") {
|
|
content.scroll({ top: content.scrollHeight, behavior });
|
|
} else {
|
|
content.scrollTop = content.scrollHeight;
|
|
}
|
|
this.hasMore = false;
|
|
},
|
|
onScroll(e) {
|
|
const { content } = this.$refs;
|
|
this.paused = content.scrollTop + content.clientHeight + 1 < content.scrollHeight;
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped lang="scss">
|
|
section {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
|
|
main {
|
|
flex: 1;
|
|
overflow: auto;
|
|
}
|
|
.scroll-bar-notification {
|
|
text-align: right;
|
|
margin-right: 65px;
|
|
button {
|
|
position: fixed;
|
|
bottom: 30px;
|
|
}
|
|
}
|
|
|
|
.fade-enter-active,
|
|
.fade-leave-active {
|
|
transition: opacity 0.15s ease-in;
|
|
}
|
|
.fade-enter,
|
|
.fade-leave-to {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
</style>
|