fix bugs
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user