最近需要一个周历课程表,无奈在网上找了半天都没找到,只能自己动手
上代码
//wxml
//我在网上找了一个小程序的月历,在其基础上进行的更改,并增加了左右滑动切换日历的事件
<
view
bindtouchstart=
"touchStart"
bindtouchend=
"touchEnd">
<
view
class=
'box1'
style=
'width: {
{ sysW * 7 }}px'><
span
bindtap=
"last">上
</
span
><
span
bindtap=
"next">下
</
span
>
<
view
class=
'dateBox'
>{
{ year }} - {
{ month}}
</
view
>
<
block
wx:for=
'{
{ weekArr }}'>
<
view
style=
'width: {
{ sysW }}px; height: {
{ sysW }}px; line-height: {
{ sysW }}px;'>{
{ item }}
</
view
>
</
block
>
<
block
wx:for=
'{
{ arr }}'>
<
view
style=
'width: {
{ sysW }}px; height: {
{ sysW }}px; line-height: {
{ sysW }}px;'
class=
'{
{ item == getDate ? "dateOn" : ""}} {
{font==1?item>7?"font-color":"":font==2?item<7?"font-color":"":"" }}'>{
{ item }}
</
view
>
</
block
>
</
view
>
</view>
//wxss
.box1
.dateBox{
width:
100%;
height:
50px;
line-height:
50px;
text-align:
center;
margin-top:
20px;
font-size:
40
rpx;
}
.box1{
display:
flex;
flex-wrap:
wrap;
margin:
0
auto;
}
.box1>
view{
height:
30px