• iview TimePicker实现选择时间段



    <FormItem label="拜访时间" prop="fromHospital">
    <TimePicker
    v-model="value"
    format="HH:mm"
    :value="value"
    type="timerange"
    placement="bottom-start"
    placeholder="Select time"
    style="310px"
    @on-change="getDuration"></TimePicker>
    </FormItem>




    getDuration () {
    var startTime = this.value[0].split(':')
    var endTime = this.value[1].split(':')
    console.log(this.value[0])
    console.log(this.value[1])
    this.formItem.clinicalStartTimeStr = this.value[0]
    this.formItem.clinicalEndTimeStr = this.value[1]
    var time = (parseInt(endTime[0]) * 60 + parseInt(endTime[1])) - (parseInt(startTime[0]) * 60 + parseInt(startTime[1]))
    // 小时数
    var hour = parseInt(time / 60)
    var minute = time % 60
    if (hour > 0) {
    // return hour+"小时"+minute+"分钟"
    if (hour) {
    this.formValidate.duration = hour + '小时' + minute + '分钟'
    } else {
    this.formValidate.duration = ''
    }
    } else {
    if (!isNaN(minute)) {
    this.formValidate.duration = minute + '分钟'
    } else {
    this.formValidate.duration = ''
    }
    }
    },
    我要再和生活死磕几年,要么我就毁灭,要么我就注定辉煌,如果有一天,你发现我在平庸面前低了头,请向我开炮。
  • 相关阅读:
    P1631-序列合并
    P1484-种树
    17.树的子结构(python)
    16.合并两个排序的链表(python)
    反转链表
    链表中倒数第k个节点(python)
    调整数组顺序使奇数位于偶数前面(python)
    Spark--wordcount(词频降序)
    数值的整数次方
    二进制中1的个数(python)
  • 原文地址:https://www.cnblogs.com/nlovestudy/p/13037430.html
Copyright © 2020-2023  润新知