cardDiv.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="card-div">
  3. <view class="card-div__gapL" :style="{ backgroundColor: colorGap }"></view>
  4. <view class="card-div__line" :style="{ backgroundColor: colorLine }"></view>
  5. <view class="card-div__gapR" :style="{ backgroundColor: colorGap }"></view>
  6. </view>
  7. </template>
  8. <script setup lang="ts">
  9. const props = defineProps({
  10. colorLine: {
  11. type: String,
  12. default: "#eee",
  13. },
  14. colorGap: {
  15. type: String,
  16. default: "#f0f1f6",
  17. }
  18. });
  19. </script>
  20. <style>
  21. /* 卡片分割线样式 */
  22. .card-div {
  23. --circle-size: 26upx;
  24. position: relative;
  25. width: 100%;
  26. height: 80upx;
  27. margin: 20upx 0;
  28. display: flex;
  29. align-items: center;
  30. justify-content: center;
  31. }
  32. .card-div__line {
  33. height: 1upx;
  34. width: 92%;
  35. border-bottom: 1upx dashed #eee;
  36. }
  37. .card-div__gapL {
  38. content: '';
  39. display: block;
  40. width: var(--circle-size);
  41. height: var(--circle-size);
  42. border-radius: 50%;
  43. background-color: #f0f1f6;
  44. position: absolute;
  45. top: 50%;
  46. left: calc(var(--circle-size) / -2);
  47. transform: translate(0, -50%);
  48. }
  49. .card-div__gapR {
  50. content: '';
  51. display: block;
  52. width: var(--circle-size);
  53. height: var(--circle-size);
  54. border-radius: 50%;
  55. background-color: #f0f1f6;
  56. position: absolute;
  57. top: 50%;
  58. right: calc(var(--circle-size) / -2);
  59. transform: translate(0%, -50%);
  60. }
  61. </style>