<template>
	<view>
		<block v-for="(item,index) in list" :key="index">
			<uni-card :border="false" :is-shadow="false" :padding="0">
				<view class="web-cell web-cell-align-top">
					<uv-cell-group :customStyle="{backgroundColor: '#ffffff', padding: '8px 0'}" :border="false">
						<uv-cell :title="`${item.title}`" :label="item.createTime" :cellStyle="{padding: '8px'}"
							:border="false" @click="openUrl('/package/article/detail?id='+item.articleId)">
							<template v-slot:value>
								<uv-image :src="item.image" width="80px" height="80px"></uv-image>
							</template>
						</uv-cell>
					</uv-cell-group>
				</view>
			</uni-card>
		</block>
	</view>
</template>

<script>
	import * as ArticleApi from '@/api/cms/article'
	export default {
		data() {
			return {
				id: 0,
				list: []
			}
		},
		onLoad(e) {
			const {
				id
			} = e
			ArticleApi.pageArticle({
				categoryId: id
			}).then(res => {
				if (res.count > 0) {
					this.list = res.list;
					const item = res.list[0]
					uni.setNavigationBarTitle({
						title: item.categoryName
					})
				}
			})
		},
		methods: {
			openUrl(url) {
				uni.navigateTo({
					url
				});
			},
		}
	}
</script>

<style>

</style>