feat: add useScroller

This commit is contained in:
chenjiahan
2020-08-28 11:52:16 +08:00
parent 7fd4e3eabb
commit 0a701e549c
3 changed files with 25 additions and 17 deletions
+14
View File
@@ -0,0 +1,14 @@
import { Ref, ref, onMounted } from 'vue';
import { getScroller } from '../utils/dom/scroll';
export function useScroller(el: Ref<HTMLElement>) {
const scrollerRef = ref();
onMounted(() => {
if (el.value) {
scrollerRef.value = getScroller(el.value);
}
});
return scrollerRef;
}