Files
guangan-mp/components/i-news-list/i-news-list.vue
2025-06-16 10:09:19 +08:00

55 lines
1.3 KiB
Vue

<template>
<view>
<view class="p-3 rounded-lg bg-white mt-2 flex flex-row" v-for="(item,index) in resdata" :key="index" @click="toShow(item)" style="gap: 20rpx;">
<view class="flex-0" v-if="item.imgs.length > 0" style="flex-basis: 256rpx;">
<image :src="item.imgs[0]" style="width:256rpx;height: 160rpx; border-radius: 16rpx;" mode="aspectFill"></image>
</view>
<view class="flex-5 flex flex-column justify-between" style="height: 160rpx;">
<view><text class="font32 line15">{{item.title}}</text></view>
<view class="flex align-center justify-between mt-2">
<view class="flex align-center">
<text class="font24 text-muted">{{item.publish_at}}</text>
</view>
<view class="flex align-center">
</view>
<view class="flex align-center">
<text class="font24 text-muted">{{item.view_count}}人浏览</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name:"i-news-list",
props:{
resdata:{
type:Array,
default() {
return [];
},
}
},
data() {
return {
};
},
created() {
console.log(this.resdata)
},
methods:{
toShow(item){
uni.navigateTo({
url:'/pages/news/detail?id='+item.id,
})
}
}
}
</script>
<style>
</style>