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 {
1414 toRef ,
1515 getCurrentInstance ,
1616 onBeforeUnmount ,
17+ isVue3 ,
1718} from 'vue-demi'
1819
1920/**
@@ -171,7 +172,11 @@ export const rtdbPlugin = function rtdbPlugin(
171172 const globalOptions = Object . assign ( { } , defaultOptions , pluginOptions )
172173 const { bindName, unbindName } = globalOptions
173174
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 (
175180 key : string ,
176181 reset ?: RTDBOptions [ 'reset' ]
177182 ) {
@@ -180,7 +185,7 @@ export const rtdbPlugin = function rtdbPlugin(
180185 }
181186
182187 // add $rtdbBind and $rtdbUnbind methods
183- app . config . globalProperties [ bindName ] = function rtdbBind (
188+ GlobalTarget [ bindName ] = function rtdbBind (
184189 this : ComponentPublicInstance ,
185190 key : string ,
186191 source : database . Reference | database . Query ,
You can’t perform that action at this time.
0 commit comments