fix: comma input behavior
This commit is contained in:
parent
61501dba8d
commit
889d4afbf5
6 changed files with 113 additions and 50 deletions
|
|
@ -394,22 +394,30 @@ watch(
|
|||
outlined
|
||||
input-class="text-right"
|
||||
style="width: 90px"
|
||||
debounce="500"
|
||||
:model-value="
|
||||
commaInput(props.row.discount.toString() || '0')
|
||||
discount4Show[props.rowIndex] ||
|
||||
commaInput(props.row.discount?.toString() || '0')
|
||||
"
|
||||
@blur="
|
||||
() => {
|
||||
props.row.discount = Number(
|
||||
discount4Show[props.rowIndex].replace(/,/g, ''),
|
||||
);
|
||||
if (props.row.discount % 1 === 0) {
|
||||
const [, dec] =
|
||||
discount4Show[props.rowIndex].split('.');
|
||||
if (!dec) {
|
||||
discount4Show[props.rowIndex] += '.00';
|
||||
}
|
||||
}
|
||||
}
|
||||
"
|
||||
@update:model-value="
|
||||
(v) => {
|
||||
if (typeof v === 'string')
|
||||
discount4Show[props.rowIndex] = commaInput(v);
|
||||
const x = parseFloat(
|
||||
discount4Show[props.rowIndex] &&
|
||||
typeof discount4Show[props.rowIndex] === 'string'
|
||||
? discount4Show[props.rowIndex].replace(/,/g, '')
|
||||
: '',
|
||||
discount4Show[props.rowIndex] = commaInput(
|
||||
v?.toString() || '0',
|
||||
'string',
|
||||
);
|
||||
props.row.discount = x;
|
||||
$emit('updateTable', props.row);
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { QTableProps } from 'quasar';
|
||||
import { dateFormat } from 'src/utils/datetime';
|
||||
|
||||
import { formatNumberDecimal, commaInput } from 'stores/utils';
|
||||
import { formatNumberDecimal } from 'stores/utils';
|
||||
|
||||
import BadgeComponent from 'components/BadgeComponent.vue';
|
||||
import KebabAction from 'components/shared/KebabAction.vue';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue