Skip to content

Commit 4137b3b

Browse files
chore(compat) assign hack needs to use symbol bootstrap-vue#7181, bootstrap-vue#7182
1 parent 5173dd1 commit 4137b3b

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/vue.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,38 @@ if (isVue3) {
3333
const originalVModelDynamicCreated = Vue.vModelDynamic.created
3434
const originalVModelDynamicBeforeUpdate = Vue.vModelDynamic.beforeUpdate
3535

36-
// See https://github.com/vuejs/vue-next/pull/4121 for details
36+
// See https://github.com/vuejs/vue-next/pull/4121 and https://github.com/vuejs/core/pull/8681 for details
3737
Vue.vModelDynamic.created = function(el, binding, vnode) {
38-
originalVModelDynamicCreated.call(this, el, binding, vnode)
39-
if (!el._assign) {
40-
el._assign = () => {}
38+
const assignSymbol = Object.getOwnPropertySymbols(el).find(s => s.description === '_assign')
39+
if (assignSymbol && !el[assignSymbol]) {
40+
el[assignSymbol] = () => {}
4141
}
42+
originalVModelDynamicCreated.call(this, el, binding, vnode)
4243
}
4344
Vue.vModelDynamic.beforeUpdate = function(el, binding, vnode) {
45+
const assignSymbol = Object.getOwnPropertySymbols(el).find(s => s.description === '_assign')
46+
if (assignSymbol && !el[assignSymbol]) {
47+
el[assignSymbol] = () => {}
48+
}
4449
originalVModelDynamicBeforeUpdate.call(this, el, binding, vnode)
45-
if (!el._assign) {
46-
el._assign = () => {}
50+
}
51+
52+
const originalVModelCheckBoxCreated = Vue.vModelCheckbox.created
53+
const originalVModelCheckBoxBeforeUpdate = Vue.vModelCheckbox.beforeUpdate
54+
55+
Vue.vModelCheckbox.created = function(el, binding, vnode) {
56+
const assignSymbol = Object.getOwnPropertySymbols(el).find(s => s.description === '_assign')
57+
if (assignSymbol && !el[assignSymbol]) {
58+
el[assignSymbol] = () => {}
59+
}
60+
originalVModelCheckBoxCreated.call(this, el, binding, vnode)
61+
}
62+
Vue.vModelCheckbox.beforeUpdate = function(el, binding, vnode) {
63+
const assignSymbol = Object.getOwnPropertySymbols(el).find(s => s.description === '_assign')
64+
if (assignSymbol && !el[assignSymbol]) {
65+
el[assignSymbol] = () => {}
4766
}
67+
originalVModelCheckBoxBeforeUpdate.call(this, el, binding, vnode)
4868
}
4969
extend = function patchedBootstrapVueExtend(definition) {
5070
if (typeof definition === 'object' && definition.render && !definition.__alreadyPatched) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy