import TyComponent from '../common/component'

TyComponent({
  /**
   * 组件的属性列表
   */
  properties: {
    time: {
      type: Number
    },
    format: {
      type: String,
      value: 'HH:mm:ss'
    },
    autoStart: {
      type: Boolean,
      value: true
    },
    millisecond: {
      type: Boolean,
      value: false
    },
    useSlot: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },
  /**
   * 组件的方法列表
   */
  methods: {
    handleFinish(event) {
      this.triggerEvent('finish', event.detail)
    },
    handleChange(event) {
      this.triggerEvent('change', event.detail)
    },
    start() {
      const countDown = this.selectComponent('.ht-count-down')
      countDown.start()
    },
    pause() {
      const countDown = this.selectComponent('.ht-count-down')
      countDown.pause()
    },
    reset() {
      const countDown = this.selectComponent('.ht-count-down')
      countDown.reset()
    }
  }
})
