Skip to content

AInputNumberEx 扩展数字输入

代码演示

字符串模式
解决antd字符串模式下绑定的值还是number的问题,方便有些后端用字符串存数字,不用在提交的时候做转换
vue
<template>
  <a-input-number-ex
    v-model:value="value"
    :min="1"
    :max="10"
    stringMode
    style="width: 140px"
    @change="handleChange"
  />
</template>

<script setup lang="ts">
import { ref } from "vue";
const value = ref("1");
function handleChange(val) {
  console.log(val);
}
</script>
自定义加减控件
左减右加
vue
<template>
  <a-input-number-ex
    v-model:value="value"
    :min="1"
    :max="10"
    customControls
    style="width: 140px"
    @change="handleChange"
  />
</template>

<script setup lang="ts">
import { ref } from "vue";
const value = ref(1);
function handleChange(val) {
  console.log(val);
}
</script>

API

参数说明类型默认值
stringMode字符串模式booleanfalse
customControls自定义加减控件booleanfalse