Skip to content

Commit

Permalink
fix(input): fix missing dot key on ios
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Jul 10, 2024
1 parent 7bc91a8 commit 2dd86cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
20 changes: 4 additions & 16 deletions packages/varlet-ui/src/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
:maxlength="maxlength"
:rows="rows"
:enterkeyhint="enterkeyhint"
:inputmode="inputmode"
:inputmode="type === 'number' ? 'decimal' : undefined"
:style="{
color: !errorMessage ? textColor : undefined,
caretColor: !errorMessage ? focusColor : undefined,
Expand Down Expand Up @@ -94,7 +94,7 @@
:placeholder="!hint ? placeholder : undefined"
:maxlength="maxlength"
:enterkeyhint="enterkeyhint"
:inputmode="inputmode"
:inputmode="type === 'number' ? 'decimal' : undefined"
:style="{
color: !errorMessage ? textColor : undefined,
caretColor: !errorMessage ? focusColor : undefined,
Expand Down Expand Up @@ -160,7 +160,7 @@ export default defineComponent({
} = useValidation()
const cursor = computed(() => (props.disabled || props.readonly ? '' : 'text'))
const normalizedType = computed<InputType>(() => {
if (props.type === 'number' || props.type === 'decimal') {
if (props.type === 'number') {
return 'text'
}
Expand Down Expand Up @@ -203,17 +203,6 @@ export default defineComponent({
resetValidation,
}
const inputmode = computed(() => {
switch (props.type) {
case 'number':
return 'numeric'
case 'decimal':
return 'decimal'
}
return undefined
})
call(bindForm, inputProvider)
onSmartMounted(() => {
Expand Down Expand Up @@ -248,7 +237,7 @@ export default defineComponent({
let { value } = target
if (props.type === 'number' || props.type === 'decimal') {
if (props.type === 'number') {
value = formatNumber(value)
}
Expand Down Expand Up @@ -387,7 +376,6 @@ export default defineComponent({
maxlengthText,
formDisabled: form?.disabled,
formReadonly: form?.readonly,
inputmode,
n,
classes,
isEmpty,
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/input/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type PropType, InputHTMLAttributes } from 'vue'
import { defineListenerProp, pickProps } from '../utils/components'
import { fieldDecoratorProps } from '../field-decorator'

export type InputType = 'text' | 'password' | 'number' | 'tel' | 'email' | 'decimal'
export type InputType = 'text' | 'password' | 'number' | 'tel' | 'email'

export type InputValidateTrigger = 'onFocus' | 'onBlur' | 'onChange' | 'onClick' | 'onClear' | 'onInput'

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/types/input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export declare const inputProps: Record<keyof InputProps, any>

export type InputValidateTrigger = 'onFocus' | 'onBlur' | 'onChange' | 'onClick' | 'onClear' | 'onInput'

export type InputType = 'text' | 'password' | 'number' | 'tel' | 'email' | 'decimal'
export type InputType = 'text' | 'password' | 'number' | 'tel' | 'email'

export type InputSize = 'small' | 'normal'

Expand Down

0 comments on commit 2dd86cd

Please sign in to comment.