44 lines
1.0 KiB
HTML
44 lines
1.0 KiB
HTML
<div class="timeline">
|
|
<VirtualList component="{{StatusListItem}}"
|
|
items="{{statuses}}"
|
|
on:scrollToBottom="addMoreItems()" />
|
|
</div>
|
|
<style>
|
|
.timeline {
|
|
min-height: 50vh;
|
|
}
|
|
</style>
|
|
<script>
|
|
import { store } from '../_utils/store'
|
|
import { getHomeTimeline } from '../_utils/mastodon/oauth'
|
|
import fixture from '../_utils/fixture.json'
|
|
import StatusListItem from './StatusListItem.html'
|
|
import VirtualList from './VirtualList.html'
|
|
import { splice } from 'svelte-extras'
|
|
|
|
let i = -1
|
|
|
|
const createData = () => fixture.slice(0, 5).map(_ => ({
|
|
key: `${++i}`,
|
|
props: _
|
|
}))
|
|
|
|
export default {
|
|
data: () => ({
|
|
target: 'home',
|
|
statuses: createData(),
|
|
StatusListItem: StatusListItem
|
|
}),
|
|
store: () => store,
|
|
components: {
|
|
VirtualList
|
|
},
|
|
methods: {
|
|
splice: splice,
|
|
addMoreItems() {
|
|
console.log('addMoreItems')
|
|
this.splice('statuses', this.get('statuses').length, 0, ...createData())
|
|
}
|
|
}
|
|
}
|
|
</script> |