Skip to content

Commit 2efdc0a

Browse files
authored
修复taro中input@update:model-value事件会触发两次 #1632 (#1790)
* feat: 发票组件+taro * feat: 发票组件+taro * fix: #1450将placeholder默认为空 * fix: 解决发票 radio类型的问题 * fix: navbar修改leftShow默认值 * fix: #1521navbar解决定不安全区域问题 * fix: 修改input taro demo文案 * fix: 修复taro中input@update:model-value事件会触发两次 #1632 * fix: 修复input组件的slot=input插槽报错,卡住页面 #1776
1 parent 5f96976 commit 2efdc0a

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/packages/__VUE/input/index.taro.vue

+9-7
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@ export default create({
329329
value = value.slice(0, Number(props.maxLength));
330330
}
331331
updateValue(value);
332-
emit('update:modelValue', value, event);
333-
emit('change', value, event);
334332
};
335333
336334
const updateValue = (value: string, trigger: import('./type').InputFormatTrigger = 'onChange') => {
@@ -428,16 +426,20 @@ export default create({
428426
watch(
429427
() => props.modelValue,
430428
() => {
431-
updateValue(getModelValue());
432-
resetValidation();
429+
if (!slots.input) {
430+
updateValue(getModelValue());
431+
resetValidation();
432+
}
433433
}
434434
);
435435
436436
onMounted(() => {
437-
if (props.autofocus) {
438-
inputRef.value.focus();
437+
if (!slots.input) {
438+
if (props.autofocus) {
439+
inputRef.value.focus();
440+
}
441+
updateValue(getModelValue(), props.formatTrigger);
439442
}
440-
updateValue(getModelValue(), props.formatTrigger);
441443
});
442444
443445
return {

src/packages/__VUE/input/index.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,17 @@ export default create({
425425
watch(
426426
() => props.modelValue,
427427
() => {
428-
updateValue(getModelValue());
429-
resetValidation();
428+
if (!slots.input) {
429+
updateValue(getModelValue());
430+
resetValidation();
431+
}
430432
}
431433
);
432434
433435
onMounted(() => {
434-
updateValue(getModelValue(), props.formatTrigger);
436+
if (!slots.input) {
437+
updateValue(getModelValue(), props.formatTrigger);
438+
}
435439
});
436440
437441
return {

0 commit comments

Comments
 (0)