Date Picker

时间选择器。

使用

  1. <m-date-picker selected-date="2019-10-8"></m-date-picker>

与文本框一起工作

  1. import { define, WeElement, render, h } from 'omi'
  2. import 'omim/date-picker'
  3. import 'omim/text-field'
  4. import 'omim/locate'
  5. define('my-app', class extends WeElement {
  6. show = true
  7. date = '2019-10-8'
  8. onIconClick = () => {
  9. this.show = !this.show
  10. this.update()
  11. }
  12. onSelect = (evt) => {
  13. this.show = false
  14. this.date = evt.detail
  15. this.update()
  16. }
  17. render() {
  18. return <div>
  19. <m-text-field rightIcon='today' id='myTextField' value={this.date} label='Date of birth' onIconClick={this.onIconClick} iconEvent={true} />
  20. <m-locate to="#myTextField" direction='bottom-left' show={this.show}>
  21. <m-date-picker selected-date={this.date} onSelect={this.onSelect}></m-date-picker>
  22. </m-locate>
  23. </div>
  24. }
  25. })
  26. render(<my-app />, 'body')

API

Props

  1. {
  2. selectedDate: string
  3. }

Events

  • select