header.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="u-calendar-header u-border-bottom">
  3. <text
  4. class="u-calendar-header__title"
  5. v-if="showTitle"
  6. >{{ title }}
  7. </text>
  8. <text
  9. class="u-calendar-header__subtitle"
  10. v-if="showSubtitle"
  11. >{{ subtitle }}
  12. </text>
  13. <view class="u-calendar-header__weekdays">
  14. <text class="u-calendar-header__weekdays__weekday">一</text>
  15. <text class="u-calendar-header__weekdays__weekday">二</text>
  16. <text class="u-calendar-header__weekdays__weekday">三</text>
  17. <text class="u-calendar-header__weekdays__weekday">四</text>
  18. <text class="u-calendar-header__weekdays__weekday">五</text>
  19. <text class="u-calendar-header__weekdays__weekday">六</text>
  20. <text class="u-calendar-header__weekdays__weekday">日</text>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name: 'u-calendar-header',
  27. mixins: [uni.$u.mpMixin, uni.$u.mixin],
  28. props: {
  29. // 标题
  30. title: {
  31. type: String,
  32. default: ''
  33. },
  34. // 副标题
  35. subtitle: {
  36. type: String,
  37. default: ''
  38. },
  39. // 是否显示标题
  40. showTitle: {
  41. type: Boolean,
  42. default: true
  43. },
  44. // 是否显示副标题
  45. showSubtitle: {
  46. type: Boolean,
  47. default: true
  48. },
  49. },
  50. data() {
  51. return {}
  52. },
  53. methods: {
  54. name() {
  55. }
  56. },
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. @import "../../libs/css/components.scss";
  61. .u-calendar-header {
  62. padding-bottom: 4px;
  63. &__title {
  64. font-size: 16px;
  65. color: $u-main-color;
  66. text-align: center;
  67. height: 42px;
  68. line-height: 42px;
  69. font-weight: bold;
  70. }
  71. &__subtitle {
  72. font-size: 14px;
  73. color: $u-main-color;
  74. height: 40px;
  75. text-align: center;
  76. line-height: 40px;
  77. font-weight: bold;
  78. }
  79. &__weekdays {
  80. @include flex;
  81. justify-content: space-between;
  82. &__weekday {
  83. font-size: 13px;
  84. color: $u-main-color;
  85. line-height: 30px;
  86. flex: 1;
  87. text-align: center;
  88. }
  89. }
  90. }
  91. </style>