图书馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

104 lines
2.3 KiB

<template>
<view class="item-container" @click="$emit('click')">
<view class="item-box">
<view class="item-box-left">
<image
class="img-item"
:src="data.base64Cover || data.cover || data.imgCover || '/static/images/default-book.png'"
mode="scaleToFill"
@error="onImgError"
></image>
</view>
<view class="item-box-right">
<view class="item-title line-clamp-2">{{ data.title || data.name || '暂无标题' }}</view>
<text class="item-author">{{ data.author || '佚名' }}</text>
<text class="item-publish">{{ data.publisher || '暂无出版社数据' }}</text>
</view>
</view>
</view>
</template>
<script>
import config from '@/utils/config';
export default {
name: "book-list-item",
props: {
data: {
type: Object,
required: true
}
},
data() {
return {
baseUrl: config.baseUrl
}
},
methods: {
onImgError(e) {
e.target.src = "/static/images/default-book.png";
}
}
};
</script>
<style lang="scss" scoped>
.item-container {
padding-bottom: 10px;
.item-box {
display: flex;
justify-content: flex-start;
align-items: flex-start;
// margin: 0 10px;
padding: 10px;
background-color: #fff;
border-radius: 6px;
// box-shadow: 0 1px 4px rgba(0,0,0,0.08);
border-bottom: 1px solid #f4f4f4;
.item-box-left {
margin-right: 8px;
.img-item{
width: 64px;
height: 90px;
margin: 0 12px 0 0;
border-radius: 5px;
}
}
.item-box-right {
display: flex;
flex-direction: column;
justify-content: flex-start;
flex: 1;
.item-title {
font-size: 15px;
font-weight: bold;
color: #000;
padding-bottom: 10px;
}
.item-author,
.item-publish {
font-size: 12px;
color: #888;
padding-bottom: 10px;
}
.hot-text {
font-size: 12px;
color: #ff4444;
}
.item-desc {
padding-top: 5px;
font-size: 13px;
color: #666;
line-height: 1.4;
}
.item-bottom-box {
margin-top: 8px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
}
}
</style>