header.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 }}</text>
  7. <text
  8. class="u-calendar-header__subtitle"
  9. v-if="showSubtitle"
  10. >{{ subtitle }}</text>
  11. <view class="u-calendar-header__weekdays">
  12. <text class="u-calendar-header__weekdays__weekday">{{ weekText[0] }}</text>
  13. <text class="u-calendar-header__weekdays__weekday">{{ weekText[1] }}</text>
  14. <text class="u-calendar-header__weekdays__weekday">{{ weekText[2] }}</text>
  15. <text class="u-calendar-header__weekdays__weekday">{{ weekText[3] }}</text>
  16. <text class="u-calendar-header__weekdays__weekday">{{ weekText[4] }}</text>
  17. <text class="u-calendar-header__weekdays__weekday">{{ weekText[5] }}</text>
  18. <text class="u-calendar-header__weekdays__weekday">{{ weekText[6] }}</text>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { mpMixin } from '../../libs/mixin/mpMixin';
  24. import { mixin } from '../../libs/mixin/mixin';
  25. export default {
  26. name: 'u-calendar-header',
  27. mixins: [mpMixin, 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. weekText: {
  51. type: Array,
  52. default: () => {
  53. return ['一', '二', '三', '四', '五', '六', '日']
  54. }
  55. },
  56. },
  57. data() {
  58. return {
  59. }
  60. },
  61. methods: {
  62. name() {
  63. }
  64. },
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. @import "../../libs/css/components.scss";
  69. .u-calendar-header {
  70. display: flex;
  71. flex-direction: column;
  72. padding-bottom: 4px;
  73. &__title {
  74. font-size: 16px;
  75. color: $u-main-color;
  76. text-align: center;
  77. height: 42px;
  78. line-height: 42px;
  79. font-weight: bold;
  80. }
  81. &__subtitle {
  82. font-size: 14px;
  83. color: $u-main-color;
  84. height: 40px;
  85. text-align: center;
  86. line-height: 40px;
  87. font-weight: bold;
  88. }
  89. &__weekdays {
  90. @include flex;
  91. justify-content: space-between;
  92. &__weekday {
  93. font-size: 13px;
  94. color: $u-main-color;
  95. line-height: 30px;
  96. flex: 1;
  97. text-align: center;
  98. }
  99. }
  100. }
  101. </style>