feat: add event type definition

This commit is contained in:
波比小金刚 2021-07-02 16:33:41 +08:00 committed by Herrington Darkholme
parent e6c38e6d6f
commit 721a3d2743

View File

@ -51,7 +51,7 @@ export default defineComponent({
barStore.value[bar.value.axis] = (e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]))
}
const clickTrackHandler = e => {
const clickTrackHandler = (e: MouseEvent) => {
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client])
const thumbHalf = (thumb.value[bar.value.offset] / 2)
const thumbPositionPercentage = ((offset - thumbHalf) * 100 / instance.value[bar.value.offset])
@ -59,7 +59,7 @@ export default defineComponent({
wrap.value[bar.value.scroll] = (thumbPositionPercentage * wrap.value[bar.value.scrollSize] / 100)
}
const startDrag = e => {
const startDrag = (e: MouseEvent) => {
e.stopImmediatePropagation()
cursorDown.value = true
on(document, 'mousemove', mouseMoveDocumentHandler)
@ -68,7 +68,7 @@ export default defineComponent({
document.onselectstart = () => false
}
const mouseMoveDocumentHandler = e => {
const mouseMoveDocumentHandler = (e: MouseEvent) => {
if (cursorDown.value === false) return
const prevPage = barStore.value[bar.value.axis]