This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div | |
ref="viewport" | |
:style="{ height: `${viewportHeight}px` }" | |
@scroll.passive="onScroll" | |
> | |
<div | |
:style="{ height: `${totalHeight}px` }" | |
> | |
<section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
offsetBody () { | |
const scrollTop = (this.$refs.viewport as Element).scrollTop | |
const remainTopNumber = Math.floor(this.remainLineNumber / 2) | |
const remainTopHeight = remainTopNumber * this.renderLineHeight | |
const remainBottomHeight = (this.remainLineNumber - remainTopNumber) * this.renderLineHeight | |
const thresholdHeight = this.thresholdNumber * this.renderLineHeight | |
const gap = scrollTop - this.bodyTranslateY | |
const overThreshold = gap < remainTopHeight - thresholdHeight || gap > remainTopHeight + thresholdHeight | |
const isReachBottom = this.totalHeight - (scrollTop + this.viewportHeight) < remainBottomHeight | |
const isReachTop = scrollTop < remainTopHeight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div | |
ref="viewport" | |
:style="{ height: `${containerHeight}px` }" | |
@scroll.passive="onScroll" | |
> | |
<table | |
:class="$style.header" | |
> | |
<thead> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<table | |
:style="{ maxWidth: `${bodyWidthString}` }" | |
> | |
<thead ref="head"> | |
<tr> | |
<th | |
v-for="(header,index) in headers" | |
:key="index" |
OlderNewer