<template>
    <van-field
      :value="value"
      @input="value => $emit('change', value.trim())"
      :label="label" :rules="requireRule(required, label, type)" :is-link="isLink" :readonly="readonly"
      :placeholder="`请输入${label}`" :clearable="clearable" :disabled="disabled" :required="required"
      :maxlength="maxlength" />
</template>

<script>
import mixin from './mixin'
/**
 * 输入框组件
 */
export default {
  mixins: [mixin],
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    type: {
      type: String
    },
    maxlength: {
      type: Number,
      default: 20
    },
    isLink: {
      type: Boolean,
      default: false
    },
    readonly: {
      type: Boolean,
      default: false
    }
  }
}
</script>
