Skip to content

Commit

Permalink
fix(runtime-dom): fix vShow not respect passing display
Browse files Browse the repository at this point in the history
  • Loading branch information
Doctor-wu committed Jan 19, 2024
1 parent ee4cd78 commit f2d54d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/runtime-dom/src/directives/vShow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
}
},
updated(el, { value, oldValue }, { transition }) {
if (!value === !oldValue) return
if (!value === !oldValue && el.style.display === el[vShowOldKey]) return
if (transition) {
if (value) {
transition.beforeEnter(el)
Expand Down
1 change: 1 addition & 0 deletions packages/runtime-dom/src/modules/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
// so we always keep the current `display` value regardless of the `style`
// value, thus handing over control to `v-show`.
if (vShowOldKey in el) {
el[vShowOldKey] = style.display
style.display = currentDisplay
}
}
Expand Down

0 comments on commit f2d54d5

Please sign in to comment.