* wip

* wip

* wip

* wip

* refactor

* Update note.vue

* wip
This commit is contained in:
syuilo
2021-02-14 22:26:07 +09:00
committed by GitHub
parent 6ce2231e70
commit 1eda7c8565
22 changed files with 3452 additions and 44 deletions

View File

@@ -3,12 +3,24 @@ import { getScrollContainer, getScrollPosition } from '@/scripts/scroll';
export default {
mounted(src, binding, vn) {
const ro = new ResizeObserver((entries, observer) => {
const pos = getScrollPosition(src);
const container = getScrollContainer(src);
if (binding.value === false) return;
let isBottom = true;
const container = getScrollContainer(src)!;
container.addEventListener('scroll', () => {
const pos = getScrollPosition(container);
const viewHeight = container.clientHeight;
const height = container.scrollHeight;
if (pos + viewHeight > height - 32) {
isBottom = (pos + viewHeight > height - 32);
console.log(isBottom);
}, { passive: true });
container.scrollTop = container.scrollHeight;
const ro = new ResizeObserver((entries, observer) => {
console.log(isBottom);
if (isBottom) {
const height = container.scrollHeight;
container.scrollTop = height;
}
});
@@ -20,6 +32,6 @@ export default {
},
unmounted(src, binding, vn) {
src._ro_.unobserve(src);
if (src._ro_) src._ro_.unobserve(src);
}
} as Directive;