<template>
  <el-form-item class="number" :label="showLabel ? label: ''" :rules="[...requireRule(required, label, validate), ...rules]" :prop="prop"
                :label-width="labelWidth">
    <el-input-number v-model="formRef.model[prop]" :placeholder="!disabled && (placeholder || `请输入${label}`)" :clearable="clearable"
                     :disabled="disabled" :size="size" :min="min" :max="max" :precision="precision" :controls="false" @change="$emit('change',formRef.model[prop])" @blur="$emit('blur')"
                     :style="{width}"
                     :step="step"/>
    <!-- <span class="suffix">{{ suffix }}</span> -->
  </el-form-item>
</template>

<script>
import mixin from './mixin'
/**
 * 数字输入框组件
 */
export default {
  mixins: [mixin],
  props: {
    step: {
      type: Number,
      default: 1, // 默认步长为1
    },
    min: {
      type: Number,
      default: 0
    },
    max: {
      type: Number,
      default: 99999999
    },
    precision: {
      type: Number,
      default: 0
    },
    labelWidth: {
      type: String
    },
    size: {
      type: String
    }
  }
}
</script>

<style scoped>
.suffix {
  font-size: 14px;
  color: #ff6600;
  line-height: 20px;
  padding-left: 20px;
}
</style>
<style>
.number .el-input-number input{
  text-align: left;
}
</style>
