<template>
	<view class="football-box" style="margin-top: 5%;">
		<u-sticky>
			<u-tabs :list="list" lineColor="#e1b89c" :activeStyle="{
            color: '#e1b89c',
            transform: 'scale(1.05)'
        }" :inactiveStyle="{
            color: '#606266',
            transform: 'scale(1)'
        }" itemStyle="padding-left:20%; padding-right: 20%; height: 34px;" @change="tabsChange">
			</u-tabs>
		</u-sticky>
		<u-line></u-line>
		<view class="u-page">
			<u-list @scrolltolower="scrolltolower" style="height: 560px;">
				<u-list-item v-for="(item, index) in indexList" :key="index">
					<!-- 					<u-cell :title="`${index + 1}`">
						<u-list-cell>1111</u-list-cell>
						<u-list-cell>2222</u-list-cell>
					</u-cell> -->
					<u-cell>
						<template #title>
								<span>{{`${index+1}`}}</span> 
							<!-- <u-avatar shape="square" size="35" :src="item.url"></u-avatar> -->
						</template>
					</u-cell>
				</u-list-item>
			</u-list>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from 'vue'


	const list = ref([{
			name: '周榜'
		},
		{
			name: '月榜'
		}
	])
	const indexList = ref([]);
	const urls = [
		'https://cdn.uviewui.com/uview/album/1.jpg',
		'https://cdn.uviewui.com/uview/album/2.jpg',
		'https://cdn.uviewui.com/uview/album/3.jpg',
		'https://cdn.uviewui.com/uview/album/4.jpg',
		'https://cdn.uviewui.com/uview/album/5.jpg',
		'https://cdn.uviewui.com/uview/album/6.jpg',
		'https://cdn.uviewui.com/uview/album/7.jpg',
		'https://cdn.uviewui.com/uview/album/8.jpg',
		'https://cdn.uviewui.com/uview/album/9.jpg',
		'https://cdn.uviewui.com/uview/album/10.jpg',
	];

	const onLoad = () => {
		loadmore();
	};

	const scrolltolower = () => {
		loadmore();
	};

	const name = ref('大侠')

	const loadmore = () => {
		for (let i = 0; i < 30; i++) {
			indexList.value.push({
				url: urls[uni.$u.random(0, urls.length - 1)],
				name: `${name.value}${i}`
			});
		}
		console.log(indexList.value);
	};

	onMounted(() => {
		onLoad()
	})
</script>

<style lang="scss" scoped>
	.football-box {
		width: 100vw;
		background-color: #fff;
		border-radius: 10rpx 10rpx 0 0;
	}
</style>