日历深色当天

This commit is contained in:
luyuan 2020-10-13 09:15:08 +08:00
parent bbe9e3bcc2
commit 9e2122a466
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 22 additions and 15 deletions

View File

@ -7,6 +7,7 @@ export function getdate(yue?: number){
}
yue = now.month() + 1;
const day = now.date() // 当前天
const zhou = now.day(); // 当前周
now = now.date(1)
const week = now.day(); // 第一天是星期几
now = now.month(now.month() + 1);
@ -44,6 +45,6 @@ export function getdate(yue?: number){
}
console.log(date)
return {date, year, yue};
return {date, year, yue, day, zhou};
}

View File

@ -16,19 +16,19 @@
</div>
<div class="yue">
<div class="heads">
<div>周日</div>
<div>周一</div>
<div>周二</div>
<div>周三</div>
<div>周四</div>
<div>周五</div>
<div>周六</div>
<div :class="{zhou: yue == 0 && month.zhou == 0}">周日</div>
<div :class="{zhou: yue == 0 && month.zhou == 1}">周一</div>
<div :class="{zhou: yue == 0 && month.zhou == 2}">周二</div>
<div :class="{zhou: yue == 0 && month.zhou == 3}">周三</div>
<div :class="{zhou: yue == 0 && month.zhou == 4}">周四</div>
<div :class="{zhou: yue == 0 && month.zhou == 5}">周五</div>
<div :class="{zhou: yue == 0 && month.zhou == 6}">周六</div>
</div>
<div class="body">
<div class="row" v-for="(item,index) in month.date" :key="index">
<div v-for="(i,j) in item" :key="j">
<div class="day">
<div>
<div :class="{ing: yue == 0 && month.day == i.day}">
{{i.day}}
<!-- <div class="item">
<div></div><p>asdsadas</p>
@ -109,6 +109,10 @@
border-right: 1px solid #eee;
box-sizing: border-box;
}
.zhou{
color: #fff;
background: #08AE98;
}
}
.body{
.row{
@ -192,20 +196,22 @@ export default defineComponent({
setup(){
console.log(1)
const date = getdate();
console.log(date)
const month = ref(date);
let yue = 0;
const yue = ref(0);
function xia(){
yue = yue + 1;
month.value = getdate(yue)
yue.value = yue.value + 1;
month.value = getdate(yue.value)
}
function shang(){
yue = yue - 1;
month.value = getdate(yue)
yue.value = yue.value - 1;
month.value = getdate(yue.value)
}
return {
month,
xia,
shang
shang,
yue
}
}
})