uni-section.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="uni-section">
  3. <view v-if="type" class="uni-section__head">
  4. <view :class="type" class="uni-section__head-tag" />
  5. </view>
  6. <view class="uni-section__content">
  7. <text :class="{'distraction':!subTitle}" class="uni-section__content-title">{{ title }}</text>
  8. <text v-if="subTitle" class="uni-section__content-sub">{{ subTitle }}</text>
  9. </view>
  10. <slot />
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name: 'UniTitle',
  16. props: {
  17. type: {
  18. type: String,
  19. default: ''
  20. },
  21. title: {
  22. type: String,
  23. default: ''
  24. },
  25. subTitle: {
  26. type: String,
  27. default: ''
  28. }
  29. },
  30. data() {
  31. return {}
  32. },
  33. watch: {
  34. title(newVal) {
  35. if (uni.report && newVal !== '') {
  36. uni.report('title', newVal)
  37. }
  38. }
  39. },
  40. methods: {
  41. onClick() {
  42. this.$emit('click')
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .uni-section {
  49. /* #ifndef APP-NVUE */
  50. display: flex;
  51. /* #endif */
  52. margin-top: 10px;
  53. flex-direction: row;
  54. align-items: center;
  55. padding: 0 10px;
  56. height: 50px;
  57. background-color: $uni-bg-color-grey;
  58. border-bottom-color: $uni-border-color;
  59. border-bottom-style: solid;
  60. border-bottom-width: 1px;
  61. font-weight: normal;
  62. }
  63. .uni-section__head {
  64. flex-direction: row;
  65. justify-content: center;
  66. align-items: center;
  67. margin-right: 10px;
  68. }
  69. .line {
  70. height: 15px;
  71. background-color: $uni-text-color-disable;
  72. border-radius: 5px;
  73. width: 3px;
  74. }
  75. .circle {
  76. width: 8px;
  77. height: 8px;
  78. border-top-right-radius: 50px;
  79. border-top-left-radius: 50px;
  80. border-bottom-left-radius: 50px;
  81. border-bottom-right-radius: 50px;
  82. background-color: $uni-text-color-disable;
  83. }
  84. .uni-section__content {
  85. flex: 1;
  86. color: $uni-text-color;
  87. }
  88. .uni-section__content-title {
  89. font-size: $uni-font-size-base;
  90. color: $uni-text-color;
  91. }
  92. .distraction {
  93. flex-direction: row;
  94. align-items: center;
  95. }
  96. .uni-section__content-sub {
  97. font-size: $uni-font-size-sm;
  98. color: $uni-text-color-grey;
  99. }
  100. </style>