File tree Expand file tree Collapse file tree
packages/uni-mp-core/src/runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 ref ,
77} from 'vue'
88
9- import { initBaseInstance } from './componentInstance'
9+ import { callHook , hasHook , initBaseInstance } from './componentInstance'
1010import { initHooks , initRuntimeHooks , initUnknownHooks } from './componentHooks'
1111import { getLocaleLanguage } from '../runtime/util'
1212
@@ -127,6 +127,8 @@ export function initCreateSubpackageApp(parseAppOptions?: ParseAppOptions) {
127127 } )
128128 if ( ! app ) return
129129 ; ( vm . $ as any ) . ctx . $scope = app
130+ ; ( vm . $ as any ) . ctx . $hasHook = hasHook
131+ ; ( vm . $ as any ) . ctx . $callHook = callHook
130132 const globalData = app . globalData
131133 if ( globalData ) {
132134 Object . keys ( appOptions . globalData ) . forEach ( ( name ) => {
Original file line number Diff line number Diff line change @@ -199,15 +199,19 @@ export function initMocks(
199199 } )
200200}
201201
202- function hasHook ( this : ComponentPublicInstance , name : string ) {
202+ export function hasHook ( this : ComponentPublicInstance , name : string ) {
203203 const hooks = ( this . $ as any ) [ name ]
204204 if ( hooks && hooks . length ) {
205205 return true
206206 }
207207 return false
208208}
209209
210- function callHook ( this : ComponentPublicInstance , name : string , args ?: unknown ) {
210+ export function callHook (
211+ this : ComponentPublicInstance ,
212+ name : string ,
213+ args ?: unknown
214+ ) {
211215 if ( name === 'mounted' ) {
212216 callHook . call ( this , 'bm' ) // beforeMount
213217 this . $ . isMounted = true
You can’t perform that action at this time.
0 commit comments