category-mini-card.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="category-mini-card">
  3. <cache-image
  4. class="img"
  5. height="120rpx"
  6. :url="$utils.checkThumbnailUrl(category.thumbnail)"
  7. :fileMd5="$utils.checkThumbnailUrl(category.thumbnail)"
  8. mode="aspectFill"
  9. ></cache-image>
  10. <text class="label">{{ category.postCount }}&nbsp;篇</text>
  11. <view class="name">{{ category.name }}</view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'category-mini-card',
  17. props: {
  18. category: {
  19. type: Object,
  20. default: () => {}
  21. }
  22. }
  23. };
  24. </script>
  25. <style scoped lang="scss">
  26. .category-mini-card {
  27. display: inline-block;
  28. width: 260rpx;
  29. height: 180rpx;
  30. position: relative;
  31. border-radius: 12rpx;
  32. background-color: #fff;
  33. overflow: hidden;
  34. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
  35. position: relative;
  36. .img {
  37. width: 100%;
  38. height: 120rpx;
  39. border: 6rpx 6rpx 0 0;
  40. overflow: hidden;
  41. }
  42. .label {
  43. position: absolute;
  44. left: 0;
  45. top: 86rpx;
  46. color: #03a9f4;
  47. font-size: 24rpx;
  48. background-color: rgba(255, 255, 255, 1);
  49. border-radius: 0rpx 24rpx 0 0;
  50. display: flex;
  51. padding: 2rpx 12rpx;
  52. padding-right: 24rpx;
  53. }
  54. .name {
  55. position: absolute;
  56. bottom: 16rpx;
  57. left: 0;
  58. right: 0;
  59. font-size: 24rpx;
  60. text-align: center;
  61. color: #333;
  62. }
  63. }
  64. </style>