1. 程式人生 > >vue 傳值及判斷

vue 傳值及判斷

<div v-for="z in list" style="height: 0.3rem;">
  <div class="date">{{z.year}}-{{z.day}}</div>
    <ul class="date_ul" @click="coach(z.day)" :time="z.day">
      <li v-for="x in z.calendar" v-if="x.type == '1'" style="background: #fff"> </li>
      <li v-for="x in z.calendar" v-if="x.type == '2'" style="background: #f938ab"> </li>
      <li v-for="x in z.calendar" v-if="x.type == '3'" style="background: #ffc107"> {{x.type}}</li>
      <li v-for="x in z.calendar" v-if="x.type == '4'" style="background: #5f9ea0"> {{x.type}}</li>
    </ul>

</div>
    <div v-show="ishow" class="fiex">
    <div @click="hide" class="hide"></div>
    <div  :time_="tim" class="time_body">
      <div class="login_time">
        起止時間
      </div>

      <div style="width: 20px;height: 20px;background: #3ABA63">
        <mt-datetime-picker
          ref="picker"
          type="time"
         >
        </mt-datetime-picker>
      </div>

    </div>
    </div>

    data () {
      return {
        tim:[],
        ishow:false,

 coach:function (day) {
        // console.log(day)
        this.ishow = !this.ishow
        if(this.ishow){
          this.tim=day
          console.log(this.tim)
        }else {

        }
      },
      hide:function () {
        this.ishow = !this.ishow
      },