<template>
|
<view class="card" @click="handleClick(item)">
|
<image :src="item.imgurl" mode="widthFix" class="card-image" />
|
<view class="card-title">
|
<up-text :lines="2" size="14px" :text="item.title" bold></up-text>
|
</view>
|
<view class="card-footer">
|
<view class="user-info">
|
<up-avatar :src="item.avatar" size="40rpx" shape="circle" />
|
<view class="user-text">
|
<text class="nickname">{{ item.username }}</text>
|
</view>
|
</view>
|
<view class="opera-info">
|
<up-icon name="heart" size="30rpx" color="#999" />
|
<text>{{ item.likes }}</text>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup lang="ts">
|
defineProps<{
|
item: any
|
}>()
|
|
const emit = defineEmits(['click'])
|
const handleClick = (item) => {
|
emit('click', item)
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.card {
|
border-radius: 10rpx;
|
background-color: #ffffff;
|
font-size: 14px;
|
line-height: 20px;
|
color: rgb(51, 51, 51);
|
margin: 10rpx;
|
|
.card-image {
|
width: 100%;
|
border-radius: inherit;
|
}
|
|
.card-title {
|
padding: 10rpx;
|
font-weight: 500;
|
}
|
|
.card-footer {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding: 10rpx;
|
}
|
|
.user-info {
|
display: flex;
|
align-items: center;
|
|
.user-text {
|
font-size: 18rpx;
|
line-height: 14px;
|
margin-left: 10rpx;
|
|
.nickname {
|
font-weight: bold;
|
display: block;
|
color: #646464;
|
}
|
}
|
}
|
|
.opera-info {
|
display: flex;
|
align-items: center;
|
|
text {
|
margin-left: 10rpx;
|
font-size: 12px;
|
}
|
}
|
}
|
</style>
|