Skip to content

Commit

Permalink
fix(runtime-dom/v-model): only set selectedIndex when the value chang…
Browse files Browse the repository at this point in the history
…es (#3845)
  • Loading branch information
HcySunYang committed May 30, 2021
1 parent 8b94464 commit ecd97ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/runtime-dom/src/directives/vModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ function setSelected(el: HTMLSelectElement, value: any) {
}
} else {
if (looseEqual(getValue(option), value)) {
el.selectedIndex = i
if (el.selectedIndex !== i) el.selectedIndex = i
return
}
}
}
if (!isMultiple) {
if (!isMultiple && el.selectedIndex !== -1) {
el.selectedIndex = -1
}
}
Expand Down

0 comments on commit ecd97ee

Please sign in to comment.