element-ui笔记

 1、日历控件修改,自定义时间切换按钮

<div class="detailModal_container_part3" :style="{'marginTop':detailCarNature != 2 ? '' : '12px'}">
                <div class="detailDiv_part_titleDiv">
                  <div class="detailDiv_part_title">出车记录</div>
                  <div class="detailDiv_part_btn">
                    <i class="el-icon-arrow-left" @click="clickLast"></i>
                    <div>{{monthValue}}</div>
                    <i class="el-icon-arrow-right" @click="clickNext"></i>
                  </div>

                </div>
                <div class="part3_calendarDiv">
                  <el-calendar :first-day-of-week=7 v-model="carRecordsMonth" ref="domCalendarBtn">
                    <template slot="dateCell" slot-scope="{date, data}">
                      <!-- carRecordsArr -->
                      <div v-if="brightDate.includes(data.day)">
                        <el-popover placement="top-start" title="" trigger="hover" popper-class="carRecordsPopper">
                          <div class="">
                            <div>
                              {{brightContent(data.day).date}}
                            </div>
                            <div>
                              运单数:{{brightContent(data.day).recordTimes}}笔
                            </div>
                          </div>
                          <div slot="reference">
                            <p>
                              {{ data.day.split('-').slice(2).join('-') }}<br />
                            </p>
                            <!--标记-->
                            <div class="budge"></div>
                          </div>
                        </el-popover>
                      </div>
                      <div v-else>
                        <p>
                          {{ data.day.split('-').slice(2).join('-') }}<br />
                        </p>
                      </div>
                    </template>
                  </el-calendar>
                </div>
</div>




//js

watch: {
      '$route'(to, from) { // 监听路由改变
      },
      carRecordsMonth: {
        handler(newVal, objVal) {
          if(newVal){
            console.log(newVal);
            console.log(this.carRecordsMonth);
            this.monthValue = this.$moment(this.carRecordsMonth).format('YYYY年M月');
            // if (this.carRecordsMonth != newVal) {
              // console.log('可以调动')
              this.getCarRecordList(); //获取当月出车记录
            // }
          }
        },
      }
    },
computed: {
      // 统计有出车记录的数组
      brightDate () {
        let ary = []
        for (let i in this.carRecordsArr) {
          if (this.carRecordsArr[i].recordTimes > 1) {
            ary.push(this.carRecordsArr[i].recordDate)
          }
        }
        return ary
      },
    },



 methods: {
  clickLast() {//上个月
 	this.$refs.domCalendarBtn.$children[0].$children[0].$el.click()
  },
  clickNext() {//下个月
	this.$refs.domCalendarBtn.$children[0].$children[2].$el.click()
  },
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

仰望半月

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值