<template>
	<home-frame @toPath="toPath">
		<view class="main">
			<view class="one">
				<view class="list" v-for="(item,index) in list" :key="index">
					<image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
					</image>
					<view class="name textOver">
						{{item.title}}
					</view>
				</view>
			</view>
		</view>
	</home-frame>
</template>

<script>
	import homeFrame from "../components/home-frame.vue";
	export default {
		components: {
			homeFrame
		},
		data() {
			return {
				list: []
			};
		},
		onLoad() {
			const that = this;
			that.search()
		},
		onShow() {

		},
		methods: {
			async search() {
				const that = this;
				// 轮播图
				let res;
				res = await that.$api('appapk', 'GET', {
					is_use: '0',
					limit: 100
				});
				if (res.errcode == '0') {
					that.$set(that, `list`, res.data)
				}

			},
			// 跳转页面
			toPath(e) {
				let url = `/${e.route}`;
				if (e.type == '0') uni.navigateTo({
					url
				})
				else if (e.type == '1') uni.redirectTo({
					url
				})
				else if (e.type == '2') uni.reLaunch({
					url
				})
				else if (e.type == '3') uni.switchTab({
					url
				})
			}
		},
	};
</script>

<style lang="scss">
	.main {
		background-color: var(--rgb000);
		display: flex;
		flex-direction: column;
		width: 100vw;
		height: 92vh;

		.one {
			padding: 8px;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			background-color: var(--rgb000);

			.list {
				width: 18%;
				margin: 0 0 10px 0;

				.image {
					width: 100%;
					height: 62px;
					overflow: hidden;
					border-radius: 5px;
				}

				.name {
					font-size: 12px;
					color: var(--rgbfff);
					text-align: center;
				}
			}
		}
	}
</style>
