kopia lustrzana https://github.com/nolanlawson/pinafore
				
				
				
			
		
			
				
	
	
		
			37 wiersze
		
	
	
		
			958 B
		
	
	
	
		
			HTML
		
	
	
			
		
		
	
	
			37 wiersze
		
	
	
		
			958 B
		
	
	
	
		
			HTML
		
	
	
<div class="timeline">
 | 
						|
  <VirtualList component="{{StatusListItem}}" items="{{statuses}}" />
 | 
						|
  <button type="button" on:click="addMoreItems()">Add more items</button>
 | 
						|
</div>
 | 
						|
<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, 20).map(_ => ({
 | 
						|
    key: `${++i}`,
 | 
						|
    props: _
 | 
						|
  }))
 | 
						|
 | 
						|
  export default {
 | 
						|
    data: () => ({
 | 
						|
      target: 'home',
 | 
						|
      statuses: createData(),
 | 
						|
      StatusListItem: StatusListItem
 | 
						|
    }),
 | 
						|
    store: () => store,
 | 
						|
    components: {
 | 
						|
      VirtualList
 | 
						|
    },
 | 
						|
    methods: {
 | 
						|
      splice: splice,
 | 
						|
      addMoreItems() {
 | 
						|
        this.splice('statuses', this.get('statuses').length, 0, ...createData())
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
</script> |