<template>
  <view class="w-full">
    <view @click="show = true">
      <u-input
        class="w-full !pointer-events-none"
        :placeholder="placeholder"
        :value="status"
        type="select"
      />
    </view>
    <u-picker
      @confirm="handleConfirm"
      mode="time"
      v-model="show"
      :params="{ year: true }"
    ></u-picker>
  </view>
</template>
<script>
import { omit } from 'lodash-es'
export default {
  props: {
    value: {
      type: [Array, Object, String, Number],
    },
    params: {
      type: Object,
      default: () => ({}),
    },
    labelField: {
      type: String,
      default: 'label',
    },
    valueField: {
      type: String,
      default: 'value',
    },
    placeholder: {
      type: String,
      default: '请选择',
    },
  },

  data() {
    return {
      show: false,
      isFirstLoad: true,
      status: '',
    }
  },
  computed: {},
  created() {
    this.fetch()
  },
  methods: {
    async fetch() {},
    emitChange() {
      this.$emit('options-change', this.getOptions)
    },
    handleConfirm(e) {
      let str = ''
      Object.keys(e).forEach((key) => {
        str += e[key]
      })
      this.status = str
      this.$emit('change', str)
      this.$emit('input', str)
    },
    isFunction(fn) {
      return typeof fn === 'function'
    },
  },
  watch: {
    value: {
      handler(e) {
        
        this.status = e
      },
      deep: true,
      immediate: true,
    },
  },
}
</script>
