2022-01-16 15:24:24 -09:00
|
|
|
<template>
|
2025-06-20 00:09:12 +07:00
|
|
|
<div
|
|
|
|
class="d-flex align-center"
|
|
|
|
style="max-width: 60px"
|
|
|
|
>
|
2022-01-16 15:24:24 -09:00
|
|
|
<v-text-field
|
|
|
|
v-model.number="quantity"
|
|
|
|
hide-details
|
2022-08-15 23:55:51 +02:00
|
|
|
:label="$t('form.quantity-label-abbreviated')"
|
2022-01-16 15:24:24 -09:00
|
|
|
:min="min"
|
|
|
|
:max="max"
|
|
|
|
type="number"
|
|
|
|
class="rounded-xl"
|
2025-06-20 00:09:12 +07:00
|
|
|
size="small"
|
|
|
|
variant="plain"
|
|
|
|
/>
|
2022-01-16 15:24:24 -09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2025-06-20 00:09:12 +07:00
|
|
|
export default defineNuxtComponent({
|
2022-01-16 15:24:24 -09:00
|
|
|
name: "VInputNumber",
|
|
|
|
props: {
|
|
|
|
min: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
max: {
|
|
|
|
type: Number,
|
|
|
|
default: 9999,
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
step: {
|
|
|
|
type: Number,
|
|
|
|
default: 1,
|
|
|
|
},
|
2025-06-20 00:09:12 +07:00
|
|
|
modelValue: {
|
2022-01-16 15:24:24 -09:00
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
},
|
2025-06-20 00:09:12 +07:00
|
|
|
emits: ["update:modelValue"],
|
2022-01-16 15:24:24 -09:00
|
|
|
setup(props, context) {
|
|
|
|
const quantity = computed({
|
|
|
|
get: () => {
|
2025-06-20 00:09:12 +07:00
|
|
|
return Number(props.modelValue);
|
2022-01-16 15:24:24 -09:00
|
|
|
},
|
|
|
|
set: (val) => {
|
2025-06-20 00:09:12 +07:00
|
|
|
context.emit("update:modelValue", val);
|
2022-01-16 15:24:24 -09:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
quantity,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2022-08-15 23:55:51 +02:00
|
|
|
</script>
|