customCard.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="custom-card">
  3. <!-- 固定头部:滚动时内容不再钻到系统状态栏下面 -->
  4. <nav-top-bar :background="background">
  5. <view class="custom-card-header">
  6. <view class="custom-card-action">
  7. <u-icon name="arrow-left" color="#333333" size="32rpx" @tap="BackPage"/>
  8. <view class="custom-card-action-text">
  9. <slot name="backText"></slot>
  10. </view>
  11. </view>
  12. <view class="cu-bar-right">
  13. <slot name="right"></slot>
  14. </view>
  15. </view>
  16. </nav-top-bar>
  17. </view>
  18. </template>
  19. <script>
  20. import NavTopBar from '@/components/nav-top-bar/nav-top-bar.vue';
  21. export default {
  22. name: 'custom-card',
  23. components: {
  24. NavTopBar,
  25. },
  26. props: {
  27. // 固定栏背景,不传时使用业务页通用渐变,特殊背景页可覆盖
  28. background: {
  29. type: String,
  30. default: 'linear-gradient(102deg, #bfeadd 6.77%, #b8f1e7 40.15%, #b9eef5 84.02%)',
  31. },
  32. },
  33. data() {
  34. return {};
  35. },
  36. methods: {
  37. BackPage() {
  38. uni.navigateBack({
  39. delta: 1,
  40. });
  41. },
  42. },
  43. };
  44. </script>
  45. <style scoped lang="scss">
  46. .custom-card {
  47. border-radius: 16upx;
  48. opacity: 1;
  49. // 状态栏高度由 nav-top-bar 的占位撑起
  50. }
  51. .custom-card-header {
  52. padding: 0 20rpx;
  53. height: 90rpx;
  54. color: #333333;
  55. font-size: 28rpx;
  56. font-weight: 600;
  57. font-family: 'PingFang SC';
  58. line-height: 44rpx;
  59. position: relative;
  60. .custom-card-action {
  61. display: flex;
  62. align-items: center;
  63. height: 90rpx;
  64. line-height: 90rpx;
  65. .custom-card-action-text {
  66. width: 90%;
  67. text-align: center;
  68. color: #042118;
  69. font-size: 34rpx;
  70. }
  71. }
  72. .cu-bar-right {
  73. position: absolute;
  74. right: 20rpx;
  75. top: 20rpx;
  76. }
  77. }
  78. </style>