cardDiv.vue 1.3 KB

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