Skip to content

Commit

Permalink
fix: fixed unmount with vue3 directive and ssr error in mergeData fun…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
milesingrams committed Dec 1, 2021
1 parent fd11101 commit 93f58e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 0 additions & 5 deletions packages/vue/src/directives/xyz.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ export default {
updateDirective(...arguments)
},
update: updateDirective,
unbind(el, binding, vnode, oldVnode, isDestroy) {
if (!isDestroy) {
el.setAttribute('xyz', el._xyzOriginal)
}
},
}
4 changes: 1 addition & 3 deletions packages/vue3/src/directives/xyz.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ function updateDirective(el, { value }) {
}

export default {
beforeMount(el, { value }) {
beforeMount(el) {
el._xyzOriginal = el.getAttribute('xyz')
updateDirective(...arguments)
el.setAttribute('xyz', clsx(el._xyzOriginal, value))
},
updated: updateDirective,
beforeUnmount: updateDirective,
}
6 changes: 3 additions & 3 deletions packages/vue3/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export function mergeData(data1 = {}, data2 = {}) {
...data1,
...data2,
style: {
...data1.style,
...data2.style,
...data1?.style,
...data2?.style,
},
class: clsx(data1.class, data2.class),
class: clsx(data1?.class, data2?.class),
}
}

Expand Down

0 comments on commit 93f58e9

Please sign in to comment.