<template>
  <van-stepper v-model="inside_num" class="m-stepper" :min="min" :max="max" />
</template>

<script>
export default {
  props: {
    value: {
      type: [String, Number],
    },
    min: {
      type: [String, Number],
      default: 1,
    },
    max: {
      type: [String, Number],
    },
  },
  watch: {
    value(val) {
      this.inside_num = val;
    },
    inside_num(val) {
      this.$emit("input", val);
    },
  },
  data() {
    return {
      inside_num: 0,
    };
  },
  mounted() {
    this.inside_num = this.value;
  },
};
</script>

<style lang="less">
.m-stepper {
  .van-stepper__input {
    height: 25px;
    width: 46px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: bold;
    background: #f1f1f1;
  }
  > button {
    height: 22px;
    width: 22px;
  }
}
</style>
