This commit is contained in:
2026-07-21 10:57:54 +03:30
parent a60f1fbc68
commit bc642e91ed
10 changed files with 159 additions and 33 deletions
@@ -30,13 +30,14 @@
<div
class="flex items-center gap-1"
:class="variant === 'desktop' ? 'dpr-cart-row__input' : 'pr-cart-row__input'"
@focusin="selectCountInput"
>
<BasicInput
v-model:value="item.count"
:addon-before="quantityUnit"
:addon-bg-color="config.config?.color"
addon-text-color="white"
type="text"
type="number"
:inputmode="isCountBased ? 'numeric' : 'decimal'"
@update:value="onCountInput"
/>
@@ -91,6 +92,13 @@ const displayGold = computed(() => {
const config = useConfigStore()
function selectCountInput(e: FocusEvent) {
const el = e.target as HTMLInputElement | null
if (!el || el.tagName !== 'INPUT' || typeof el.select !== 'function') return
// تا کاربر با تایپ عدد جدید، مقدار قبلی را جایگزین کند
requestAnimationFrame(() => el.select())
}
function onCountInput(raw: string | number) {
countError.value = ''
const normalized = persianToEnglishDigits(String(raw ?? '').trim())