Home > Mobile >  How to change the TimePicker interval in element UI
How to change the TimePicker interval in element UI

Time:11-22

May I ask if the preset minute interval of the TimePicker in element UI is every minute, how to change it to every 10 minutes as an interval? I hope to get your help, it is quite distressing. thanks

[element UI][1] 
https://element.eleme.io/#/zh-CN/component/time-picker


[myCode][2]
https://codepen.io/hong-wei/pen/abKqpZY


  [1]: https://element.eleme.io/#/zh-CN/component/time-picker
  [2]: https://codepen.io/hong-wei/pen/abKqpZY

CodePudding user response:

the documentation you showed actually clearly shows how to implement it. https://element.eleme.io/#/en-US/component/time-picker#timepicker

So you can use the picker-options prop and use the 'step' property for custom intervals

<el-time-select
  v-model="value"
  :picker-options="{
    start: '08:30',
    step: '00:10',
    end: '18:30'
  }"
  placeholder="Select time">
</el-time-select>

CodePudding user response:

The focus method of the component can be called with refs

   <el-time-select
  v-model="value"
  :picker-options="{
    start: '08:30',
    step: '00:10',
    end: '18:30'
  }"
refs="timePicker"
  placeholder="Select time">
</el-time-select>

 this.$refs.timePicker.focus()
  • Related