Skip to content

Commit

Permalink
fix(calendar): 修复自定义起始日高亮列错误问题 (#2452)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Jul 24, 2023
1 parent 32744bd commit 1cdc34d
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ exports[`should render slot correctly 1`] = `
</view>
<view class=\\"nut-calendar__header-subtitle\\">2022年03月</view>
<view class=\\"nut-calendar__weekdays\\">
<view class=\\"nut-calendar__weekday\\">日</view>
<view class=\\"nut-calendar__weekday weekend\\">日</view>
<view class=\\"nut-calendar__weekday\\">一</view>
<view class=\\"nut-calendar__weekday\\">二</view>
<view class=\\"nut-calendar__weekday\\">三</view>
<view class=\\"nut-calendar__weekday\\">四</view>
<view class=\\"nut-calendar__weekday\\">五</view>
<view class=\\"nut-calendar__weekday\\">六</view>
<view class=\\"nut-calendar__weekday weekend\\">六</view>
</view>
</view>"
`;
Expand All @@ -25,7 +25,7 @@ exports[`should render slot correctly 2`] = `
<view class=\\"nut-calendar__month-title\\">2022年02月</view>
<view class=\\"nut-calendar__days\\">
<view class=\\"nut-calendar__days-item\\">
<view class=\\"nut-calendar__day nut-calendar__day--disabled\\">
<view class=\\"nut-calendar__day weekend nut-calendar__day--disabled\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">customundefined</view>
<!--v-if-->
Expand Down Expand Up @@ -79,7 +79,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom5</view>
<!--v-if-->
Expand All @@ -88,7 +88,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom6</view>
<!--v-if-->
Expand Down Expand Up @@ -142,7 +142,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom12</view>
<!--v-if-->
Expand All @@ -151,7 +151,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom13</view>
<!--v-if-->
Expand Down Expand Up @@ -205,7 +205,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom19</view>
<!--v-if-->
Expand All @@ -214,7 +214,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom20</view>
<!--v-if-->
Expand Down Expand Up @@ -268,7 +268,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom26</view>
<!--v-if-->
Expand All @@ -277,7 +277,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom27</view>
<!--v-if-->
Expand All @@ -302,7 +302,7 @@ exports[`should render slot correctly 2`] = `
<view class=\\"nut-calendar__month-title\\">2022年03月</view>
<view class=\\"nut-calendar__days\\">
<view class=\\"nut-calendar__days-item\\">
<view class=\\"nut-calendar__day nut-calendar__day--disabled\\">
<view class=\\"nut-calendar__day weekend nut-calendar__day--disabled\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">customundefined</view>
<!--v-if-->
Expand Down Expand Up @@ -356,7 +356,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom5</view>
<!--v-if-->
Expand All @@ -365,7 +365,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom6</view>
<!--v-if-->
Expand Down Expand Up @@ -419,7 +419,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom12</view>
<!--v-if-->
Expand All @@ -428,7 +428,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom13</view>
<!--v-if-->
Expand Down Expand Up @@ -482,7 +482,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom19</view>
<!--v-if-->
Expand All @@ -491,7 +491,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom20</view>
<!--v-if-->
Expand Down Expand Up @@ -545,7 +545,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom26</view>
<!--v-if-->
Expand All @@ -554,7 +554,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom27</view>
<!--v-if-->
Expand Down Expand Up @@ -606,7 +606,7 @@ exports[`should render slot correctly 2`] = `
<view class=\\"nut-calendar__month-title\\">2022年04月</view>
<view class=\\"nut-calendar__days\\">
<view class=\\"nut-calendar__days-item\\">
<view class=\\"nut-calendar__day nut-calendar__day--disabled\\">
<view class=\\"nut-calendar__day weekend nut-calendar__day--disabled\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">customundefined</view>
<!--v-if-->
Expand Down Expand Up @@ -660,7 +660,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom2</view>
<!--v-if-->
Expand All @@ -669,7 +669,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom3</view>
<!--v-if-->
Expand Down Expand Up @@ -723,7 +723,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom9</view>
<!--v-if-->
Expand All @@ -732,7 +732,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom10</view>
<!--v-if-->
Expand Down Expand Up @@ -786,7 +786,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom16</view>
<!--v-if-->
Expand All @@ -795,7 +795,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom17</view>
<!--v-if-->
Expand Down Expand Up @@ -849,7 +849,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom23</view>
<!--v-if-->
Expand All @@ -858,7 +858,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom24</view>
<!--v-if-->
Expand Down Expand Up @@ -912,7 +912,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom30</view>
<!--v-if-->
Expand All @@ -928,7 +928,7 @@ exports[`should render slot correctly 2`] = `
<view class=\\"nut-calendar__month-title\\">2022年05月</view>
<view class=\\"nut-calendar__days\\">
<view class=\\"nut-calendar__days-item\\">
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom1</view>
<!--v-if-->
Expand Down Expand Up @@ -982,7 +982,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom7</view>
<!--v-if-->
Expand All @@ -991,7 +991,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom8</view>
<!--v-if-->
Expand Down Expand Up @@ -1045,7 +1045,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom14</view>
<!--v-if-->
Expand All @@ -1054,7 +1054,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom15</view>
<!--v-if-->
Expand Down Expand Up @@ -1108,7 +1108,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom21</view>
<!--v-if-->
Expand All @@ -1117,7 +1117,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom22</view>
<!--v-if-->
Expand Down Expand Up @@ -1171,7 +1171,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom28</view>
<!--v-if-->
Expand All @@ -1180,7 +1180,7 @@ exports[`should render slot correctly 2`] = `
<!--v-if-->
<!--v-if-->
</view>
<view class=\\"nut-calendar__day\\">
<view class=\\"nut-calendar__day weekend\\">
<!-- 日期显示slot -->
<view class=\\"nut-calendar__day-value\\">custom29</view>
<!--v-if-->
Expand Down
13 changes: 5 additions & 8 deletions src/packages/__VUE/calendar/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
box-shadow: 0px 4px 10px 0px rgba($color: #000000, $alpha: 0.06);

.nut-calendar__weekday {
&:first-of-type,
&:last-of-type {
&.weekend {
color: $calendar-day67-font-color;
}
}
Expand Down Expand Up @@ -140,12 +139,6 @@

.nut-calendar__days {
overflow: hidden;
.nut-calendar__days-item {
.nut-calendar__day:nth-child(7n + 0),
.nut-calendar__day:nth-child(7n + 1) {
color: $calendar-day67-font-color;
}
}
.nut-calendar__day {
float: left;
width: 14.28%;
Expand All @@ -157,6 +150,10 @@
flex-direction: column;
position: relative;

&.weekend {
color: $calendar-day67-font-color;
}

.nut-calendar__day-tips {
position: absolute;
width: 100%;
Expand Down
Loading

0 comments on commit 1cdc34d

Please sign in to comment.