feat: add custom BottomButton instead of TG
This commit is contained in:
29
spa/src/components/Quantity.vue
Normal file
29
spa/src/components/Quantity.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="flex items-center text-center">
|
||||
<button class="btn btn-neutral w-10 h-10" @click="inc">-</button>
|
||||
<div class="w-10 h-10 flex items-center justify-center bg-neutral">{{ model }}</div>
|
||||
<button class="btn btn-neutral w-10 h-10" @click="dec">+</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const model = defineModel();
|
||||
const props = defineProps({
|
||||
max: Number,
|
||||
});
|
||||
|
||||
function inc() {
|
||||
if (model.value - 1 >= 0) {
|
||||
model.value--;
|
||||
}
|
||||
}
|
||||
|
||||
function dec() {
|
||||
if (props.max && model.value + 1 > props.max) {
|
||||
model.value = props.max;
|
||||
return;
|
||||
}
|
||||
|
||||
model.value++;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user