<template>
	<view>
		<page :param='{userId}' ref='page' noteEmpty='没有数据' :api='api' @updateList="updateList">
			<liveItem :list="list"></liveItem>
		</page>
	</view>
</template>

<script>
	import page from "./page.vue"
	import liveItem from "./liveItem.vue"


	import {
		getUserLiveInList,
		querySelfListLive,
		findListFabulousCollectionList
	} from '../js/request'

	export default {
		components: {
			page,
			liveItem
		},
		props: ['begin', 'collection', 'userId'],
		data() {
			const begin = this.begin
			const collection = this.collection
			return {
				list: [],
				api: begin ? querySelfListLive : (collection ? findListFabulousCollectionList : getUserLiveInList)
			}
		},
		methods: {
			pullDownRefresh() {
				this.$refs.page.pullDownRefresh()
			},
			reachBottom() {
				this.$refs.page.reachBottom()
			},
			updateList(list) {
				this.list = list
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>
