mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-21 14:30:00 +08:00
47 lines
1.0 KiB
Vue
47 lines
1.0 KiB
Vue
<template>
|
|
<component
|
|
class="tmagic-design-input-number"
|
|
:is="uiComponent.component"
|
|
v-bind="uiProps"
|
|
@change="changeHandler"
|
|
@input="inputHandler"
|
|
@update:modelValue="updateModelValue"
|
|
></component>
|
|
</template>
|
|
|
|
<script setup lang="ts" name="TMInputNumber">
|
|
import { computed } from 'vue';
|
|
|
|
import { getConfig } from './config';
|
|
|
|
const props = defineProps<{
|
|
modelValue?: string | number | boolean;
|
|
clearable?: boolean;
|
|
controlsPosition?: string;
|
|
disabled?: boolean;
|
|
placeholder?: string;
|
|
step?: number;
|
|
min?: number;
|
|
max?: number;
|
|
size?: 'large' | 'default' | 'small';
|
|
}>();
|
|
|
|
const uiComponent = getConfig('components').inputNumber;
|
|
|
|
const uiProps = computed(() => uiComponent.props(props));
|
|
|
|
const emit = defineEmits(['change', 'input', 'update:modelValue']);
|
|
|
|
const changeHandler = (...args: any[]) => {
|
|
emit('change', ...args);
|
|
};
|
|
|
|
const inputHandler = (...args: any[]) => {
|
|
emit('input', ...args);
|
|
};
|
|
|
|
const updateModelValue = (...args: any[]) => {
|
|
emit('update:modelValue', ...args);
|
|
};
|
|
</script>
|