ElementPlus TimeSelect 時(shí)間選擇

2021-09-08 09:52 更新

TimeSelect 時(shí)間選擇

用于選擇或輸入日期

固定時(shí)間點(diǎn)

提供幾個(gè)固定的時(shí)間點(diǎn)供用戶選擇


使用 el-time-select 標(biāo)簽,分別通過(guò)start、end和step指定可選的起始時(shí)間、結(jié)束時(shí)間和步長(zhǎng)

<template>
  <el-time-select
  v-model="value"
  start="08:30"
  step="00:15"
  end="18:30"
  placeholder="選擇時(shí)間"
>
</el-time-select>
</template>

<script>
  export default {
    data() {
      return {
        value: '',
      }
    },
  }
</script>

固定時(shí)間范圍

若先選擇開(kāi)始時(shí)間,則結(jié)束時(shí)間內(nèi)備選項(xiàng)的狀態(tài)會(huì)隨之改變


<template>
  <el-time-select
    placeholder="起始時(shí)間"
    v-model="startTime"
    start="08:30"
    step="00:15"
    end="18:30"
  >
  </el-time-select>
  <el-time-select
    placeholder="結(jié)束時(shí)間"
    v-model="endTime"
    start="08:30"
    step="00:15"
    end="18:30"
    :minTime="startTime"
  >
  </el-time-select>
</template>

<script>
  export default {
    data() {
      return {
        startTime: '',
        endTime: '',
      }
    },
  }
</script>

Attributes

參數(shù)說(shuō)明類型可選值默認(rèn)值
model-value / v-model綁定值string
disabled禁用booleanfalse
editable文本框可輸入booleantrue
clearable是否顯示清除按鈕booleantrue
size輸入框尺寸stringmedium / small / mini
placeholder非范圍選擇時(shí)的占位內(nèi)容string
name原生屬性string
prefix-icon自定義頭部圖標(biāo)的類名stringel-icon-time
clear-icon自定義清空?qǐng)D標(biāo)的類名stringel-icon-circle-close
start開(kāi)始時(shí)間string09:00
end結(jié)束時(shí)間string18:00
step間隔時(shí)間string00:30
minTime最小時(shí)間,小于該時(shí)間的時(shí)間段將被禁用string00:00
maxTime最大時(shí)間,大于該時(shí)間的時(shí)間段將被禁用string

Events

事件名說(shuō)明參數(shù)
change用戶確認(rèn)選定的值時(shí)觸發(fā)組件綁定值
blur當(dāng) input 失去焦點(diǎn)時(shí)觸發(fā)組件實(shí)例
focus當(dāng) input 獲得焦點(diǎn)時(shí)觸發(fā)組件實(shí)例

Methods

方法名說(shuō)明參數(shù)
focus使 input 獲取焦點(diǎn)
blur使 input 失去焦點(diǎn)


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)