<template>
  <a-form-model-item
    class="my-models"
    :wrapper-col="{span:16}"
    :label="formValue.label"
  >
    <a-select
      @change="handleChange"
      v-model="formValue.codeValue">
      <a-select-option value="HHmmss" :key="0">
        HHmmss(时分秒)
      </a-select-option>
      <a-select-option value="mmss" :key="1">
        mmss(分秒)
      </a-select-option>
      <a-select-option value="ss" :key="2">
        ss(秒)
      </a-select-option>
    </a-select>
  </a-form-model-item>
</template>

<script type="text/ecmascript-6">
import moment from 'moment'
  export default {
    props: {
      value: {
        type: Object,
        required: true
      }
    },
    data() {
      return {
        formValue: this.value
      }
    },
    methods: {
      handleChange(e, vNode) {
        const { key } = vNode
        const time = moment().format(e)
        this.formValue.codeValue = time
        this.formValue.timeType = key
        this.$emit('changeValue', this.formValue)
      }
    }
  }
</script>

<style scoped>

</style>
