header.vue 2.6 KB

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