forEach -> map

This commit is contained in:
Satsuki Yanagi 2019-07-20 07:22:36 +09:00
parent dd4fd199d3
commit b72e180ee4
No known key found for this signature in database
GPG Key ID: F68E0DDD49AF6FB6
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,7 @@ export default Vue.extend({
const day = now.getDate(); const day = now.getDate();
let x = 20; let x = 20;
this.data.slice().forEach((d, i) => { this.data = this.data.map((d, i) => {
d.x = x; d.x = x;
const date = new Date(year, month, day - i); const date = new Date(year, month, day - i);
@ -59,6 +59,8 @@ export default Vue.extend({
d.color = `hsl(${ch}, ${cs}%, ${cl}%)`; d.color = `hsl(${ch}, ${cs}%, ${cl}%)`;
if (d.date.weekday == 0) x--; if (d.date.weekday == 0) x--;
return d;
}); });
} }
}); });