Skip to content

Commit

Permalink
releases 4.3.24
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Dec 10, 2024
1 parent 57b0ec1 commit 9f75df9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-pc-ui",
"version": "4.3.23",
"version": "4.3.24",
"description": "A vue based PC component library",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
26 changes: 24 additions & 2 deletions packages/number-input/src/number-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export default defineComponent({
})

const internalData: NumberInputInternalData = {
dnTimeout: undefined
// dnTimeout: undefined,
// isUM: undefined
}

const refElem = ref() as Ref<HTMLDivElement>
Expand Down Expand Up @@ -291,6 +292,7 @@ export default defineComponent({
const handleChange = (val: number | null, inputValue: string, evnt: Event | { type: string }) => {
const value = eqEmptyValue(val) ? null : Number(val)
const isChange = value !== props.modelValue
internalData.isUM = true
if (isChange) {
emit('update:modelValue', value)
}
Expand Down Expand Up @@ -361,6 +363,23 @@ export default defineComponent({
}
}

const updateModel = (val: any) => {
const { inputValue } = reactData
const digitsValue = computeDigitsValue.value
const decimalsType = computeDecimalsType.value
if (decimalsType) {
if (val) {
let textValue = ''
if (val) {
textValue = toFloatValueFixed(val, digitsValue)
}
if (textValue !== inputValue) {
reactData.inputValue = textValue
}
}
}
}

/**
* 检查初始值
*/
Expand Down Expand Up @@ -826,7 +845,10 @@ export default defineComponent({
$xeNumberInput.renderVN = renderVN

watch(() => props.modelValue, (val) => {
reactData.inputValue = val
if (!internalData.isUM) {
updateModel(val)
}
internalData.isUM = false
})

watch(() => props.type, () => {
Expand Down
1 change: 1 addition & 0 deletions types/components/number-input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export interface NumberInputReactData {

export interface NumberInputInternalData {
dnTimeout?: undefined | number
isUM?: boolean
}

export interface NumberInputMethods {
Expand Down

0 comments on commit 9f75df9

Please sign in to comment.