scroller: use sequential keys for dash

old-stable24
Varun Patil 2022-10-19 12:57:34 -07:00
parent a1725ada86
commit 6f94d1985f
2 changed files with 12 additions and 2 deletions

View File

@ -19,7 +19,7 @@
<div class="icon"> <ScrollIcon :size="20" /> </div>
</span>
<div v-for="tick of visibleTicks" :key="tick.dayId"
<div v-for="tick of visibleTicks" :key="tick.key"
class="tick"
:class="{ 'dash': !tick.text }"
:style="{ transform: `translateY(${tick.top}px)` }">
@ -77,7 +77,15 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
/** Get the visible ticks */
get visibleTicks() {
return this.ticks.filter(tick => tick.s);
let key = 999900;
return this.ticks.filter(tick => tick.s).map(tick => {
if (tick.text) {
tick.key = key = tick.dayId * 100;
} else {
tick.key = ++key; // days are sorted descending
}
return tick;
});
}
/** Reset state */

View File

@ -146,6 +146,8 @@ export type ITick = {
text?: string | number;
/** Whether this tick should be shown */
s?: boolean;
/** Key for vue component */
key?: number
}
export type TopMatter = {