- Mock adapter implementing @vmall/shared ApiClient (localStorage-persisted cart/orders/invoices), runtime switch via mockApi flag (default on) - Fixed bilingual mock catalog: 3-level categories, 24 products w/ SKUs, stores, brands, banners, floors, seckill/collective/integral, comments, coupons, addresses, seeded orders/shipments/invoices - B2B2C mall shell: top bar, logo/search/cart header, dark nav + category mega-menu, value-prop footer, back-to-top; 1200px grid, #ca151e theme - UI primitives replacing element-plus: carousel, pagination, breadcrumb, qty stepper, rating stars, modal, tabs, step bar, product card - Pages: home floors, search (filters/sort/paging), goods detail (SKU picker, store rail, review tabs), cart -> checkout -> pay -> success, auth pages, user center (dashboard/orders/addresses/favorites/coupons/ invoices), stores, seckill, collective, integral - i18n split into per-domain locale modules (en+zh) - OpenSpec change mall-pc-storefront-replica archived; all specs green
58 lines
1.3 KiB
Vue
58 lines
1.3 KiB
Vue
<script setup lang="ts">
|
||
const props = withDefaults(defineProps<{ modelValue: number; max?: number }>(), { max: 999 });
|
||
const emit = defineEmits<{ "update:modelValue": [v: number] }>();
|
||
|
||
function set(v: number): void {
|
||
const next = Math.min(props.max, Math.max(1, Math.floor(v) || 1));
|
||
emit("update:modelValue", next);
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="stepper">
|
||
<button type="button" :disabled="modelValue <= 1" @click="set(modelValue - 1)">−</button>
|
||
<input
|
||
:value="modelValue"
|
||
type="number"
|
||
:min="1"
|
||
:max="max"
|
||
@change="set(Number(($event.target as HTMLInputElement).value))"
|
||
/>
|
||
<button type="button" :disabled="modelValue >= max" @click="set(modelValue + 1)">+</button>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.stepper {
|
||
display: inline-flex;
|
||
border: 1px solid var(--mall-line-dark);
|
||
border-radius: var(--mall-radius);
|
||
overflow: hidden;
|
||
}
|
||
button {
|
||
width: 30px;
|
||
height: 32px;
|
||
border: 0;
|
||
background: #fafafa;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
}
|
||
button:disabled {
|
||
opacity: 0.4;
|
||
cursor: not-allowed;
|
||
}
|
||
input {
|
||
width: 48px;
|
||
height: 32px;
|
||
border: 0;
|
||
border-left: 1px solid var(--mall-line);
|
||
border-right: 1px solid var(--mall-line);
|
||
text-align: center;
|
||
font-size: 13px;
|
||
outline: none;
|
||
}
|
||
input::-webkit-inner-spin-button {
|
||
display: none;
|
||
}
|
||
</style>
|