ElementUI el-time-picker只显示小时、分钟

 <el-time-picker
              is-range
              v-model="item.value"
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              format="HH:mm" //时分
              value-format="HH:mm" //时分
              placeholder="选择时间范围"
              @change="changeTime"
            >


//判断时间段是否有一致的
  
    changeTime(e) {
      console.log(e);
      const nowDate = new Date();
      let that = this;
      console.log(that.settingInfo.businessHourArr);
      var a = 0;
      var b = 0;
      var c = 0;
      var d = 0;
      that.settingInfo.businessHourArr.forEach(item => {
        if (item.value != null) {
          c++;
        }
      })
      that.settingInfo.businessHourArr.forEach(function (item, index) {
        if (c > 1) {
          if (item.value != null) {
            var start1 = '2021-5-1 ' + item.value[0] + ':00';
            var end1 = '2021-5-1 ' + item.value[1] + ':00';
            var start2 = '2021-5-1 ' + e[0] + ':00';
            var end2 = '2021-5-1 ' + e[1] + ':00';
            if (item.value[0] == e[0] && item.value[1] == e[1]) {
              a = index
              d++;
            } else if (((Date.parse(start1) <= Date.parse(start2) && Date.parse(start2) <= Date
              .parse(end1)) || (Date.parse(start1) <= Date.parse(end2) && Date.parse(
                end2) <= Date.parse(end1)) || (Date.parse(start2) <= Date.parse(start1) &&
                  Date.parse(end2) >= Date.parse(end1)))) {
              b++;
            } else {

            }
          }
        }

      })
      if (b > 0) {
        that.settingInfo.businessHourArr[a].value = null;
        that.$message('营业时间格式错误,请重新录入.');
      }
      if (d > 1) {
        that.settingInfo.businessHourArr[a].value = null;
        that.$message('营业时间格式错误,请重新录入.');
      }
    },

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值