Created
August 4, 2019 07:48
-
-
Save lili668668/3516e0789b05a48faeaa6de852d2ed3f to your computer and use it in GitHub Desktop.
固定標題列
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" | |
> | |
{{ header.text }} | |
</th> | |
</tr> | |
</thead> | |
</table> | |
<div | |
ref="viewport" | |
:style="{ height: `${viewportHeight}px` }" | |
@scroll.passive="onScroll" | |
> | |
<div | |
:style="{ height: `${totalHeight}px` }" | |
> | |
<section | |
:style="{ transform: `translateY(${bodyTranslateY}px)` }" | |
> | |
<table | |
ref="body" | |
:style="{ height: `${minBodyHeight}px` }" | |
> | |
<tbody> | |
<tr | |
v-for="(item, index) in renderItems" | |
ref="row" | |
:key="index" | |
> | |
<td | |
v-for="(header,i) in headers" | |
:key="i" | |
> | |
{{ item[header.value] }} | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</section> | |
</div> | |
</div> | |
<div | |
:style="{ maxWidth: `${bodyWidthString}` }" | |
> | |
<table> | |
<tbody> | |
<tr> | |
<td | |
v-for="(header,i) in headers" | |
:key="i" | |
> | |
{{ sum[header.value] }} | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment