add line-height possibility

This commit is contained in:
Julie Blanc 2026-03-02 17:29:49 +01:00
parent eac7acdbc6
commit 154804ee44
2 changed files with 40 additions and 3 deletions

View file

@ -89,15 +89,17 @@ const handleInput = (event) => {
emit('update:modelValue', value);
};
const decimals = (props.step.toString().split('.')[1] || '').length;
const increment = () => {
const newValue = props.modelValue + props.step;
const newValue = parseFloat((props.modelValue + props.step).toFixed(decimals));
if (props.max === undefined || newValue <= props.max) {
emit('update:modelValue', newValue);
}
};
const decrement = () => {
const newValue = props.modelValue - props.step;
const newValue = parseFloat((props.modelValue - props.step).toFixed(decimals));
if (props.min === undefined || newValue >= props.min) {
emit('update:modelValue', newValue);
}