<template>
  <div>
    <div v-if="mode === 'DESIGN'">
      <a-input
        :placeholder="placeholder"
        type="number"
        size="default"
        disabled
      />
    </div>
    <div v-else>
      <a-input
        v-if="!readerMode"
        v-model="internalValue"
        :placeholder="placeholder"
        type="number"
        size="default"
        allow-clear
      />
      <div v-else>{{ internalValue }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NumberInput',
  model: {
    prop: 'value',
    event: 'input'
  },
  props: {
    value: {
      type: [String, Number],
      default: ''
    },
    mode: {
      type: String,
      default: 'DESIGN'
    },
    placeholder: {
      type: String,
      default: '请输入数值'
    },
    readerMode: {
      type: Boolean,
      default: false
    },
    enablePrint: {
      type: Boolean,
      default: true
    },
    type: {
      type: Number
    }
  },
  computed: {
    internalValue: {
      get() {
        return this.value;
      },
      set(val) {
        console.log("******NumberInput",val)
        this.$emit('input', val);
      }
    }
  }
};
</script>

<style scoped>
/* 可根据需要添加样式 */
</style>
