<template>
  <van-field
    ref="input"
    v-model="value"
    :label="label"
    :name="name"
    :size="size"
    :placeholder="defaultPlaceholder"
    :border="border"
    :disabled="disabled"
    :required="required"
    :clearable="clearable"
    :clickable="clickable"
    :is-link="isLink"
    :error="error"
    :error-message="errorMessage"

    :arrow-direction="arrowDirection"
    :label-class="labelClass"
    :label-width="labelWidth"
    :label-align="labelAlign"
    :input-align="inputAlign"
    :error-message-align="errorMessageAlign"
    :autosize="autosize"
    :left-icon="leftIcon"
    :right-icon="rightIcon"
    :icon-prefix="iconPrefix"
    readonly
  >
    <template #label>
      {{ label }}<van-icon v-if="desc && descPosition==='lableIcon'" name="warning" class="ibps-dialog-icon" @click="$action.descDialog({ title:label, message:desc })" />
    </template>
  </van-field>
</template>
<script>
import FieldMixin from '@/mixins/field'
export default {
  mixins: [FieldMixin],
  props: {
    alias: { // 流水号别名
      type: String
    },
    readonlyText: {
      type: Boolean,
      default: false
    }
  },

  computed: {
    defaultPlaceholder() {
      if (!this.editable) {
        return ''
      }
      return this.init ? this.placeholder : '自动生成无需填写'
    }
  }

}
</script>
