File tree Expand file tree Collapse file tree 1 file changed +12
-23
lines changed Expand file tree Collapse file tree 1 file changed +12
-23
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
- <div class =" flex items-center space-x-2" >
2
+ <div
3
+ class =" flex items-center border border-gray-200 rounded-xl bg-white px-2 py-1 min-w-[120px] w-fit h-10 justify-center gap-1"
4
+ >
3
5
<button
4
- class =" px-2 py-1 bg -gray-200 rounded disabled:opacity-50 "
6
+ class =" bg-transparent border-none text -gray-900 text-xl w-9 h-9 flex items-center justify-center rounded-lg transition-colors select-none disabled:text-gray-300 disabled:cursor-not-allowed active:bg-gray-100 "
5
7
:disabled =" loading || value <= min"
6
8
@click =" updateValue(value - 1)"
7
9
aria-label =" Decrease quantity"
8
- >
9
- -
10
- </button >
11
- <input
12
- type =" number"
13
- :value =" value"
14
- :min =" min"
15
- :max =" max"
16
- class =" w-12 text-center border rounded"
17
- :disabled =" loading"
18
- @input =" onInput"
19
- />
10
+ type =" button"
11
+ >-</button >
12
+ <div class =" border-l border-gray-200 h-6 mx-1" ></div >
13
+ <span class =" min-w-8 text-center font-medium text-lg text-gray-900 px-2 select-none" >{{ value }}</span >
14
+ <div class =" border-l border-gray-200 h-6 mx-1" ></div >
20
15
<button
21
- class =" px-2 py-1 bg -gray-200 rounded disabled:opacity-50 "
16
+ class =" bg-transparent border-none text -gray-900 text-xl w-9 h-9 flex items-center justify-center rounded-lg transition-colors select-none disabled:text-gray-300 disabled:cursor-not-allowed active:bg-gray-100 "
22
17
:disabled =" loading || (max !== null && value >= max)"
23
18
@click =" updateValue(value + 1)"
24
19
aria-label =" Increase quantity"
25
- >
26
- +
27
- </button >
20
+ type =" button"
21
+ >+</button >
28
22
</div >
29
23
</template >
30
24
@@ -60,9 +54,4 @@ function updateValue(newValue) {
60
54
if (newValue < props .min ) return ;
61
55
emit (" update:modelValue" , newValue);
62
56
}
63
-
64
- function onInput (e ) {
65
- const newValue = Number (e .target .value );
66
- updateValue (newValue);
67
- }
68
57
</script >
You can’t perform that action at this time.
0 commit comments