mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 18:24:26 +08:00
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
:label="label" :placeholder="placeholder"
|
:label="label" :placeholder="placeholder"
|
||||||
:persistent-placeholder="!!persistentPlaceholder"
|
:persistent-placeholder="!!persistentPlaceholder"
|
||||||
:rules="enableRules ? rules : []" v-model="currentValue" v-if="!hide"
|
:rules="enableRules ? rules : []" v-model="currentValue" v-if="!hide"
|
||||||
@keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste">
|
@keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste" @click="onClick">
|
||||||
<template #prepend-inner v-if="currency && prependText">
|
<template #prepend-inner v-if="currency && prependText">
|
||||||
<div>{{ prependText }}</div>
|
<div>{{ prependText }}</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
:label="label" :placeholder="placeholder"
|
:label="label" :placeholder="placeholder"
|
||||||
:persistent-placeholder="!!persistentPlaceholder"
|
:persistent-placeholder="!!persistentPlaceholder"
|
||||||
:rules="enableRules ? rules : []" v-model="currentValue" v-if="hide"
|
:rules="enableRules ? rules : []" v-model="currentValue" v-if="hide"
|
||||||
@keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste">
|
@keydown="onKeyUpDown" @keyup="onKeyUpDown" @paste="onPaste" @click="onClick">
|
||||||
<template #prepend-inner v-if="currency && prependText">
|
<template #prepend-inner v-if="currency && prependText">
|
||||||
<div>{{ prependText }}</div>
|
<div>{{ prependText }}</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -90,6 +90,7 @@ const rules = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const currentValue = ref<string>(getFormattedValue(props.modelValue));
|
const currentValue = ref<string>(getFormattedValue(props.modelValue));
|
||||||
|
|
||||||
const prependText = computed<string | undefined>(() => {
|
const prependText = computed<string | undefined>(() => {
|
||||||
if (!props.currency || !props.showCurrency) {
|
if (!props.currency || !props.showCurrency) {
|
||||||
return '';
|
return '';
|
||||||
@@ -261,6 +262,13 @@ function onPaste(e: ClipboardEvent): void {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onClick(e: MouseEvent): void {
|
||||||
|
if (!props.disabled && !props.readonly && props.modelValue === 0) {
|
||||||
|
const input = e.target as HTMLInputElement;
|
||||||
|
input?.select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getValidFormattedValue(value: number, textualValue: string, hasDecimalSeparator: boolean): string {
|
function getValidFormattedValue(value: number, textualValue: string, hasDecimalSeparator: boolean): string {
|
||||||
let maxLength = TRANSACTION_MAX_AMOUNT.toString().length;
|
let maxLength = TRANSACTION_MAX_AMOUNT.toString().length;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user