Skip to content

Commit 6f9ea6e

Browse files
authored
Merge pull request #591 from devforth/feature/AdminForth/1506/we-should-not-render-so-many-z
feat: parse decimal
2 parents 4eb374f + 9b19a33 commit 6f9ea6e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

adminforth/spa/src/components/ColumnValueInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
:fullWidth="true"
100100
:prefix="column.inputPrefix"
101101
:suffix="column.inputSuffix"
102-
:modelValue="String(value)"
103-
@update:modelValue="$emit('update:modelValue', String($event))"
102+
:modelValue="value == null ? null : value.toString().replace(/(\.[0-9]*[1-9])0+$|\.0+$/, '$1')"
103+
@update:modelValue="(val: string | number | null | undefined) => $emit('update:modelValue', val == null || (typeof val === 'number' && Number.isNaN(val)) ? '' : String(val))"
104104
/>
105105
<Input
106106
v-else-if="(type || column.type) === 'float'"
@@ -206,10 +206,10 @@
206206
207207
const columnLoadingState = inject('columnLoadingState', {} as any);
208208
const onSearchInput = inject('onSearchInput', {} as any);
209+
209210
const loadMoreOptions = inject('loadMoreOptions', (() => {}) as any);
210211
211212
const input = ref<HTMLInputElement | null>(null);
212-
213213
const getBooleanOptions = (column: any) => {
214214
const options: Array<{ label: string; value: boolean | null }> = [
215215
{ label: t('Yes'), value: true },

0 commit comments

Comments
 (0)