File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
toRef ,
15
15
getCurrentInstance ,
16
16
onBeforeUnmount ,
17
+ isVue3 ,
17
18
} from 'vue-demi'
18
19
19
20
/**
@@ -171,7 +172,11 @@ export const rtdbPlugin = function rtdbPlugin(
171
172
const globalOptions = Object . assign ( { } , defaultOptions , pluginOptions )
172
173
const { bindName, unbindName } = globalOptions
173
174
174
- app . config . globalProperties [ unbindName ] = function rtdbUnbind (
175
+ const GlobalTarget = isVue3
176
+ ? app . config . globalProperties
177
+ : ( app as any ) . prototype
178
+
179
+ GlobalTarget [ unbindName ] = function rtdbUnbind (
175
180
key : string ,
176
181
reset ?: RTDBOptions [ 'reset' ]
177
182
) {
@@ -180,7 +185,7 @@ export const rtdbPlugin = function rtdbPlugin(
180
185
}
181
186
182
187
// add $rtdbBind and $rtdbUnbind methods
183
- app . config . globalProperties [ bindName ] = function rtdbBind (
188
+ GlobalTarget [ bindName ] = function rtdbBind (
184
189
this : ComponentPublicInstance ,
185
190
key : string ,
186
191
source : database . Reference | database . Query ,
You can’t perform that action at this time.
0 commit comments