category-mini-card.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="category-mini-card">
  3. <cache-image class="img" height="180rpx" :url="$utils.checkThumbnailUrl(category.spec.cover,true)"
  4. :fileMd5="$utils.checkThumbnailUrl(category.spec.cover)" mode="aspectFill"></cache-image>
  5. <view class="content">
  6. <view class="name">{{ category.spec.displayName }}</view>
  7. <text class="label">共 {{ category.postCount }} 篇</text>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'category-mini-card',
  14. props: {
  15. category: {
  16. type: Object,
  17. default: () => {}
  18. }
  19. }
  20. };
  21. </script>
  22. <style scoped lang="scss">
  23. .category-mini-card {
  24. display: inline-block;
  25. width: 260rpx;
  26. height: 180rpx;
  27. position: relative;
  28. border-radius: 12rpx;
  29. background-color: #fff;
  30. overflow: hidden;
  31. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
  32. position: relative;
  33. text-align: center;
  34. color: #ffffff;
  35. &:before {
  36. content: '';
  37. position: absolute;
  38. z-index: 1;
  39. left: 0;
  40. top: 0;
  41. width: 100%;
  42. height: 100%;
  43. background-color: rgba(0, 0, 0, 0.5);
  44. backdrop-filter: blur(3rpx);
  45. }
  46. .content {
  47. position: absolute;
  48. left: 0;
  49. top: 0;
  50. right: 0;
  51. bottom: 0;
  52. z-index: 3;
  53. display: flex;
  54. flex-direction: column;
  55. align-items: center;
  56. justify-content: center;
  57. }
  58. .img {
  59. width: 100%;
  60. height: 100%;
  61. }
  62. .name {
  63. font-weight: bold;
  64. font-size: 30rpx;
  65. }
  66. .label {
  67. font-size: 24rpx;
  68. margin-top: 6rpx;
  69. }
  70. }
  71. </style>