wip: shopping cart

This commit is contained in:
Nikita Kiselev
2025-07-21 14:24:05 +03:00
parent e3cc0d4b10
commit ce2c9e374d
5 changed files with 53 additions and 38 deletions

View File

@@ -1,15 +1,29 @@
<template>
<div class="flex items-center text-center">
<button class="btn btn-lg" @click="inc">-</button>
<button class="btn" :class="btnClassList" @click="inc">-</button>
<div class="w-10 h-10 flex items-center justify-center font-bold">{{ model }}</div>
<button class="btn btn-lg" @click="dec">+</button>
<button class="btn" :class="btnClassList" @click="dec">+</button>
</div>
</template>
<script setup>
import {computed} from "vue";
const model = defineModel();
const props = defineProps({
max: Number,
size: {
type: String,
default: '',
}
});
const btnClassList = computed(() => {
let classList = ['btn'];
if (props.size) {
classList.push(`btn-${props.size}`);
}
return classList;
});
function inc() {