Skip to content

Commit 55940bb

Browse files
committed
解决日历组件显示不对的问题
1 parent 0b995ca commit 55940bb

4 files changed

Lines changed: 91 additions & 94 deletions

File tree

‎components/uni-calendar/uni-calendar-item.vue‎

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<view>
33
<block v-for="(weeks, week) in canlender.weeks" :key="week">
4-
<view class="calender-body-date-week">
4+
<view class="uni-calender__body-date-week">
55
<block v-for="(day, index) in weeks" :key="index">
6-
<view class="date" :class="{
7-
disable: canlender.month !== day.month || day.disable,
8-
'date-current':
6+
<view class="uni-calender__date" :class="{
7+
'uni-calender__disable': canlender.month !== day.month || day.disable,
8+
'uni-calender__date-current':
99
(day.date == canlender.date || day.checked) &&
1010
canlender.month == day.month &&
1111
!day.disable,
12-
lunar: lunar,
13-
active: day.isDay,
14-
'is-day': day.isDay
12+
'uni-calender__lunar': lunar,
13+
'uni-calender__active': day.isDay,
14+
'uni-calender__is-day': day.isDay
1515
}" @tap="
1616
selectDays(
1717
week,
@@ -21,10 +21,10 @@
2121
canlender.lunar
2222
)
2323
">
24-
<view class="circle-box">
24+
<view class="uni-calender__circle-box">
2525
{{ day.date }}
26-
<view v-if="lunar" class="lunar">{{ day.lunar }}</view>
27-
<view v-if="day.have" class="data-circle"></view>
26+
<view v-if="lunar" class="uni-calender__lunar">{{ day.lunar }}</view>
27+
<view v-if="day.have" class="uni-calender__data-circle"></view>
2828
</view>
2929
</view>
3030
</block>
@@ -54,9 +54,7 @@
5454
data() {
5555
return {};
5656
},
57-
created() {
58-
59-
},
57+
created() {},
6058
methods: {
6159
selectDays(week, index, ischeck, isDay, lunar) {
6260
this.$emit('selectDays', {
@@ -74,17 +72,17 @@
7472
<style>
7573
@charset "UTF-8";
7674
77-
.calender-body-date-week {
75+
.uni-calender__body-date-week {
7876
display: flex;
7977
width: 100%;
8078
border-bottom: 1px #f5f5f5 solid
8179
}
8280
83-
.calender-body-date-week:last-child {
81+
.uni-calender__body-date-week:last-child {
8482
border: none
8583
}
8684
87-
.calender-body-date-week .date {
85+
.uni-calender__body-date-week .uni-calender__date {
8886
position: relative;
8987
width: 100%;
9088
text-align: center;
@@ -98,12 +96,12 @@
9896
line-height: 1.5
9997
}
10098
101-
.calender-body-date-week .date .lunar {
99+
.uni-calender__body-date-week .uni-calender__date .uni-calender__lunar {
102100
font-size: 20upx;
103101
color: #000
104102
}
105103
106-
.calender-body-date-week .date .circle-box {
104+
.uni-calender__body-date-week .uni-calender__date .uni-calender__circle-box {
107105
display: flex;
108106
flex-direction: column;
109107
justify-content: center;
@@ -115,36 +113,36 @@
115113
transition: all .2s
116114
}
117115
118-
.calender-body-date-week .date.disable {
116+
.uni-calender__body-date-week .uni-calender__date.uni-calender__disable {
119117
color: #d4d4d4
120118
}
121119
122-
.calender-body-date-week .date.disable .lunar {
120+
.uni-calender__body-date-week .uni-calender__date.uni-calender__disable .uni-calender__lunar {
123121
color: #d4d4d4
124122
}
125123
126-
.calender-body-date-week .date.is-day {
124+
.uni-calender__body-date-week .uni-calender__date.uni-calender__is-day {
127125
color: #fd2e32
128126
}
129127
130-
.calender-body-date-week .date.is-day .lunar {
128+
.uni-calender__body-date-week .uni-calender__date.uni-calender__is-day .uni-calender__lunar {
131129
color: #fd2e32
132130
}
133131
134-
.calender-body-date-week .date.date-current {
132+
.uni-calender__body-date-week .uni-calender__date.uni-calender__date-current {
135133
color: #fff;
136134
box-sizing: border-box
137135
}
138136
139-
.calender-body-date-week .date.date-current .circle-box {
137+
.uni-calender__body-date-week .uni-calender__date.uni-calender__date-current .uni-calender__circle-box {
140138
background: #fd2e32
141139
}
142140
143-
.calender-body-date-week .date.date-current .lunar {
141+
.uni-calender__body-date-week .uni-calender__date.uni-calender__date-current .uni-calender__lunar {
144142
color: #fff
145143
}
146144
147-
.calender-body-date-week .date .data-circle {
145+
.uni-calender__body-date-week .uni-calender__date .uni-calender__data-circle {
148146
position: absolute;
149147
top: 10upx;
150148
right: 10upx;

‎components/uni-calendar/uni-calendar.vue‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<template>
22
<view>
3-
<view class="calendar-box">
4-
<view class="calendar-wrapper ">
5-
<view class="uni-calendar-content">
6-
<view class="calendar-panel">
7-
<view class="date-befor" @tap="dataBefor('0', 'month')">
3+
<view class="uni-calendar__box">
4+
<view class="uni-calendar__wrapper">
5+
<view class="uni-calenda__content">
6+
<view class="uni-calendar__panel">
7+
<view class="uni-calendar__date-befor" @tap="dataBefor('0', 'month')">
88
<text class="iconfont icon-jiantou"></text>
99
</view>
10-
<view class="calendar-panel-box">
10+
<view class="uni-calendar__panel-box">
1111
<view>{{ canlender.year }}年</view>
1212
<view>{{ canlender.month }}月</view>
1313
</view>
14-
<view class="date-after rollback" @tap="dataBefor('1', 'month')">
14+
<view class="uni-calendar__date-after uni-calendar__rollback" @tap="dataBefor('1', 'month')">
1515
<text class="iconfont icon-jiantou "></text>
1616
</view>
17-
<view class="backtoday" @tap="backtoday">回到今天</view>
17+
<view class="uni-calendar__backtoday" @tap="backtoday">回到今天</view>
1818
</view>
19-
<view v-if="lunar" class="day-detail">
19+
<view v-if="lunar" class="uni-calendar__day-detail">
2020
<view>
2121
{{
2222
canlender.year +
@@ -44,17 +44,17 @@
4444
{{ canlender.lunar.isTerm ? canlender.lunar.Term : '' }}
4545
</view>
4646
</view>
47-
<view class="calendar-header">
48-
<view class="week">日</view>
49-
<view class="week">一</view>
50-
<view class="week">二</view>
51-
<view class="week">三</view>
52-
<view class="week">四</view>
53-
<view class="week">五</view>
54-
<view class="week">六</view>
47+
<view class="uni-calendar__header">
48+
<view class="uni-calendar__week">日</view>
49+
<view class="uni-calendar__week">一</view>
50+
<view class="uni-calendar__week">二</view>
51+
<view class="uni-calendar__week">三</view>
52+
<view class="uni-calendar__week">四</view>
53+
<view class="uni-calendar__week">五</view>
54+
<view class="uni-calendar__week">六</view>
5555
</view>
5656
<uni-calendar-item v-if="slide === 'none'" :canlender="canlender" :lunar="lunar" @selectDays="selectDays"></uni-calendar-item>
57-
<swiper v-else class="calendar-body" :style="{ height: domHeihgt + 'px' }" :current="currentIndex" circular :vertical="slide === 'vertical' ? true : false" skip-hidden-item-layout :duration="duration" @animationfinish="animationfinish" @change="change">
57+
<swiper v-else class="uni-calendar__body" :style="{ height: domHeihgt + 'px' }" :current="currentIndex" circular :vertical="slide === 'vertical' ? true : false" skip-hidden-item-layout :duration="duration" @animationfinish="animationfinish" @change="change">
5858
<swiper-item v-for="(item, itemindx) in swiperData" :key="itemindx">
5959
<view :class="elClass">
6060
<uni-calendar-item :canlender="item" :lunar="lunar" @selectDays="selectDays"></uni-calendar-item>
@@ -535,7 +535,7 @@
535535
let surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length);
536536
537537
if (!this.fixedHeihgt) {
538-
surplus = 6 - dates.endDay
538+
surplus = 6 - dates.endDay;
539539
}
540540
// 循环下个月开始几天 添加到数组
541541
for (let i = 1; i < surplus + 1; i++) {
@@ -641,7 +641,7 @@
641641
}
642642
643643
.icon-jiantou:before {
644-
content: "\e606"
644+
content: '\e606'
645645
}
646646
647647
.header {
@@ -655,21 +655,21 @@
655655
font-size: 32upx
656656
}
657657
658-
.calendar-box {
658+
.uni-calendar__box {
659659
width: 100%;
660660
box-sizing: border-box;
661661
transition: all .3s
662662
}
663663
664-
.calendar-wrapper {
664+
.uni-calendar__wrapper {
665665
width: 100%;
666666
box-sizing: border-box;
667667
font-size: 26rpx;
668668
background: #fff;
669669
transition: all .3s
670670
}
671671
672-
.calendar-wrapper .uni-calendar-content .calendar-panel {
672+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel {
673673
position: relative;
674674
display: flex;
675675
align-items: center;
@@ -678,8 +678,8 @@
678678
height: 80rpx
679679
}
680680
681-
.calendar-wrapper .uni-calendar-content .calendar-panel .date-after,
682-
.calendar-wrapper .uni-calendar-content .calendar-panel .date-befor {
681+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel .uni-calendar__date-after,
682+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel .uni-calendar__date-befor {
683683
display: flex;
684684
justify-content: center;
685685
align-items: center;
@@ -689,19 +689,19 @@
689689
line-height: 80rpx
690690
}
691691
692-
.calendar-wrapper .uni-calendar-content .calendar-panel .date-after.rollback,
693-
.calendar-wrapper .uni-calendar-content .calendar-panel .date-befor.rollback {
692+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel .uni-calendar__date-after.uni-calendar__rollback,
693+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel .uni-calendar__date-befor.uni-calendar__rollback {
694694
transform: rotate(180deg)
695695
}
696696
697-
.calendar-wrapper .uni-calendar-content .calendar-panel .calendar-panel-box {
697+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel .uni-calendar__panel-box {
698698
display: flex;
699699
justify-content: center;
700700
align-items: center;
701701
width: 200upx
702702
}
703703
704-
.calendar-wrapper .uni-calendar-content .calendar-panel .backtoday {
704+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__panel .uni-calendar__backtoday {
705705
position: absolute;
706706
right: 0;
707707
top: 15rpx;
@@ -718,27 +718,27 @@
718718
background: rgba(241, 233, 233, .4)
719719
}
720720
721-
.calendar-wrapper .uni-calendar-content .day-detail {
721+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__day-detail {
722722
padding: 20upx;
723723
padding-left: 30upx;
724724
border-top: 1px #f5f5f5 solid
725725
}
726726
727-
.calendar-wrapper .uni-calendar-content .calendar-header {
727+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__header {
728728
display: flex;
729729
font-size: 28upx;
730730
border-top: 1px #f5f5f5 solid
731731
}
732732
733-
.calendar-wrapper .uni-calendar-content .calendar-header .week {
733+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__header .uni-calendar__week {
734734
width: 100%;
735735
text-align: center;
736736
line-height: 80rpx;
737737
color: #333;
738738
font-weight: 700
739739
}
740740
741-
.calendar-wrapper .uni-calendar-content .calendar-body {
741+
.uni-calendar__wrapper .uni-calenda__content .uni-calendar__body {
742742
display: flex;
743743
flex-wrap: wrap;
744744
font-size: 28upx

‎pages.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,7 @@
666666
},
667667
{
668668
"root": "pages/template",
669-
"pages": [
670-
{
669+
"pages": [{
671670
"path": "product-list/product-list",
672671
"style": {
673672
"navigationBarTitleText": "商品列表",

‎pages/extUI/calendar/calendar.vue‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,38 @@
7676
</script>
7777

7878
<style>
79+
page {
80+
display: flex;
81+
flex-direction: column;
82+
box-sizing: border-box;
83+
background-color: #fff
84+
}
85+
86+
view {
87+
font-size: 28upx;
88+
line-height: inherit
89+
}
90+
91+
.example {
92+
padding: 0 30upx 30upx
93+
}
94+
95+
.example-title {
96+
font-size: 32upx;
97+
line-height: 32upx;
98+
color: #777;
99+
margin: 40upx 25upx;
100+
position: relative
101+
}
102+
103+
.example .example-title {
104+
margin: 40upx 0
105+
}
106+
107+
.example-body {
108+
padding: 0 40upx
109+
}
110+
79111
page {
80112
background: #fff;
81113
}
@@ -117,36 +149,4 @@
117149
border: 1px #ccc solid;
118150
padding: 15upx;
119151
}
120-
121-
page {
122-
display: flex;
123-
flex-direction: column;
124-
box-sizing: border-box;
125-
background-color: #fff
126-
}
127-
128-
view {
129-
font-size: 28upx;
130-
line-height: inherit
131-
}
132-
133-
.example {
134-
padding: 0 30upx 30upx
135-
}
136-
137-
.example-title {
138-
font-size: 32upx;
139-
line-height: 32upx;
140-
color: #777;
141-
margin: 40upx 25upx;
142-
position: relative
143-
}
144-
145-
.example .example-title {
146-
margin: 40upx 0
147-
}
148-
149-
.example-body {
150-
padding: 0 40upx
151-
}
152-
</style>
152+
</style>

0 commit comments

Comments
 (0)