hasyrails / calendar-vue-original

0 stars 0 forks source link

07 schedule display try / #14

Closed hasyrails closed 4 years ago

hasyrails commented 4 years ago

やる/やらない日をcommit date やる/やらないの状態をcommit stateで表そうとした

<div
     v-for="schedule in schedules"
     v-if="schedule.start<=day.date&&day.date<=schedule.end&&schedule.commit.date==day.date&&schedule.commit.state=='yes'"
            style="flex:1;min-height:1px;min-width:1px;max-height:10px;max-width:10px;text-align: center;border-radius:100px;margin-bottom:10px;"
            :style="'background-color:'+schedule.color+';'"
          >
            {{ schedule.name }}
          </div>

表示できない

<script>
data() {
    return {
      currentDate: moment().format('YYYY/MM'),
      schedules: [
        {
          name: 'hoge',
          start: moment('2020-09-07').date(),
          end: moment('2020-09-010').date(),
          color: 'red',
          commit: [
            {
              date: moment('2020-09-07').date(),
              state: 'yes'
            },
            {
              date: moment('2020-09-08').date(),
              state: 'no'
            },
            {
              date: moment('2020-09-09').date(),
              state: 'no'
            },
            {
              date: moment('2020-09-10').date(),
              state: 'yes'
            },
          ]
        },
        {
          name: 'fuga',
          start: moment('2020-09-08').date(),
          end: moment('2020-09-012').date(),
          color: 'blue',
          commit: [
            {
              date: moment('2020-09-08').date(),
              state: 'yes'
            },
            {
              date: moment('2020-09-09').date(),
              state: 'no'
            },
            {
              date: moment('2020-09-10').date(),
              state: 'no'
            },
            {
              date: moment('2020-09-11').date(),
              state: 'yes'
            },
            {
              date: moment('2020-09-12').date(),
              state: 'yes'
            }
          ]
        },
      ],
    };
  },
</script>
hasyrails commented 4 years ago

実際に登録したタスクから やる / やらない(commit)を選ぶ用の別配列を定義することとする → #15