<template>
  <view>
    <u-input v-model="value" type="select" :border="true" :disabled="!config.writable" @click="show = true" />
    <u-select v-model="show" :list="options" @confirm="confirm"></u-select>
  </view>
</template>

<script>
  export default {
    name: 'SELECT',
    props: ['config', 'onChange'],
    data() {
      return {
        value: '',
        options: [],
        show: false
      }
    },
    created() {
      this.value = this.config.value || ''
      this.options = this.config.options || []
    },
    methods: {
      confirm(arr) {
        this.onChange({ prop: this.config.formName, value: arr[0].value })
        this.value = arr[0].value
      }
    }
  }
</script>

<style></style>
