header.vue 1.9 KB

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