Skip to content

Commit 93f58e9

Browse files
committed
fix: fixed unmount with vue3 directive and ssr error in mergeData function
1 parent fd11101 commit 93f58e9

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

packages/vue/src/directives/xyz.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,4 @@ export default {
1010
updateDirective(...arguments)
1111
},
1212
update: updateDirective,
13-
unbind(el, binding, vnode, oldVnode, isDestroy) {
14-
if (!isDestroy) {
15-
el.setAttribute('xyz', el._xyzOriginal)
16-
}
17-
},
1813
}

packages/vue3/src/directives/xyz.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ function updateDirective(el, { value }) {
55
}
66

77
export default {
8-
beforeMount(el, { value }) {
8+
beforeMount(el) {
99
el._xyzOriginal = el.getAttribute('xyz')
1010
updateDirective(...arguments)
11-
el.setAttribute('xyz', clsx(el._xyzOriginal, value))
1211
},
1312
updated: updateDirective,
14-
beforeUnmount: updateDirective,
1513
}

packages/vue3/src/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export function mergeData(data1 = {}, data2 = {}) {
3131
...data1,
3232
...data2,
3333
style: {
34-
...data1.style,
35-
...data2.style,
34+
...data1?.style,
35+
...data2?.style,
3636
},
37-
class: clsx(data1.class, data2.class),
37+
class: clsx(data1?.class, data2?.class),
3838
}
3939
}
4040

0 commit comments

Comments
 (0)