酷炫直播运营系统小程序版本

month-calendar.vue 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view class="mask" @touchmove.stop.prevent="moveStop" @click="clearMask">
  3. <view class="mask-container" @click.stop="moveStop">
  4. <view class="operation2">
  5. <view class="month-opertaion">
  6. <view class="iconfont icon-a-xiangyou_iconcopy" @click="yearChange('reduce')"></view>
  7. <view class="monthText">{{year}}年</view>
  8. <view class="iconfont icon-xiangyou_icon" @click="yearChange('add')"></view>
  9. </view>
  10. </view>
  11. <view class="monthBox">
  12. <view :class="['monthItem',monthInfo.year==year&&month==item.value?'active':'']" v-for="(item,index) in monthList" :key="index+'monthList'" @click="monthEvent(index)">{{item.name}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name:"month-calendar",
  20. props:['monthInfo'],
  21. data() {
  22. return {
  23. monthList:[
  24. {name:'一月',value:'01'},
  25. {name:'二月',value:'02'},
  26. {name:'三月',value:'03'},
  27. {name:'四月',value:'04'},
  28. {name:'五月',value:'05'},
  29. {name:'六月',value:'06'},
  30. {name:'七月',value:'07'},
  31. {name:'八月',value:'08'},
  32. {name:'九月',value:'09'},
  33. {name:'十月',value:'10'},
  34. {name:'十一月',value:'11'},
  35. {name:'十二月',value:'12'},
  36. ],
  37. year:this.monthInfo.year,
  38. month:this.monthInfo.month,
  39. };
  40. },
  41. methods:{
  42. monthEvent(index){
  43. this.month = this.monthList[index].value
  44. this.$emit('changeMonth',{year:this.year,month:this.month})
  45. },
  46. yearChange(type){
  47. if(type=='add'){
  48. this.year += 1;
  49. }else{
  50. this.year -= 1;
  51. }
  52. },
  53. clearMask(){
  54. this.$emit('clearMask')
  55. },
  56. moveStop(){},
  57. }
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .mask{
  62. width: 100%;
  63. height: 100%;
  64. background: rgba(0,0,0,0.5);
  65. position: fixed;
  66. left: 0;
  67. top: 0;
  68. z-index: 2;
  69. .mask-container{
  70. width: 100%;
  71. height: 450rpx;
  72. background: #FFFFFF;
  73. position: absolute;
  74. left: 0;
  75. bottom: 0;
  76. .operation2{
  77. position: relative;
  78. display: flex;
  79. align-items: center;
  80. justify-content: center;
  81. height: 100rpx;
  82. border-top: 1px solid #e5e5e5;
  83. border-bottom: 1px solid #e5e5e5;
  84. .month-opertaion{
  85. display: flex;
  86. align-items: center;
  87. .monthText{
  88. text-align: center;
  89. width: 200rpx;
  90. font-size: 28rpx;
  91. color: #333;
  92. }
  93. .iconfont{
  94. color: #808080;
  95. font-size: 28rpx;
  96. }
  97. }
  98. }
  99. .monthBox{
  100. display: flex;
  101. flex-wrap: wrap;
  102. justify-content: space-around;
  103. padding-top: 30rpx;
  104. .monthItem{
  105. width: 25%;
  106. text-align: center;
  107. height: 100rpx;
  108. line-height: 80rpx;
  109. font-size: 28rpx;
  110. color: #333333;
  111. &.active{
  112. color: #007AFF;
  113. }
  114. }
  115. }
  116. }
  117. }
  118. </style>