Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(input): taro input type=number 类型问题修复 #2171

Merged
merged 3 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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