Skip to content

Commit

Permalink
fix(input): taro input type=number 类型问题修复 (#2171)
Browse files Browse the repository at this point in the history
* fix: input number 类型问题修复
* fix: input taro 问题修复
  • Loading branch information
lkjh3214 authored Mar 9, 2023
1 parent 2159298 commit ca51e72
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
23 changes: 14 additions & 9 deletions src/packages/__VUE/input/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default create({
const renderInput = (type: InputType) => {
return h('input', {
style: styles,
type: type != 'textarea' && inputType(type)
...inputType(type)
});
};
Expand Down Expand Up @@ -199,12 +199,18 @@ export default create({
const inputType = (type: InputType) => {
if (type === 'number') {
return 'text';
} else if (type === 'digit') {
return 'tel';
} else {
return type;
return {
type: 'text'
};
}
if (type === 'digit') {
return {
type: 'tel'
};
}
return { type };
};
const onInput = (event: Event) => {
Expand Down Expand Up @@ -237,10 +243,9 @@ export default create({
value = props.formatter(value);
}
if (inputRef?.value !== value) {
inputRef.value = value;
if (inputRef?.value.value !== value) {
inputRef.value.value = value;
}
if (value !== props.modelValue) {
emit('update:modelValue', value);
// emit('change', value);
Expand Down
18 changes: 12 additions & 6 deletions src/packages/__VUE/input/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default create({
const renderInput = (type: InputType) => {
return h('input', {
style: styles,
type: type != 'textarea' && inputType(type)
...inputType(type)
});
};
Expand Down Expand Up @@ -192,12 +192,18 @@ export default create({
const inputType = (type: InputType) => {
if (type === 'number') {
return 'text';
} else if (type === 'digit') {
return 'tel';
} else {
return type;
return {
type: 'text'
};
}
if (type === 'digit') {
return {
type: 'tel'
};
}
return { type };
};
const onInput = (event: Event) => {
Expand Down

0 comments on commit ca51e72

Please sign in to comment.