MorJS 擴(kuò)展能力使用

2024-01-14 11:27 更新

在 MorJS 中默認(rèn)集成了 contextPlugin 以及 eventPlugin 插件,因此在 getApp() 上,默認(rèn)會(huì)掛載有 $context$event 的屬性

import { aPage } from '@morjs/core'

aPage({
  onLoad() {
    const { appQuery } = getApp().$context
    console.log('app.js 的 onLaunch 中的全局參數(shù):', appQuery)

    const { all, emit, off, on, once } = getApp().$event
    // 全局事件支持,提供 emit, off, on, once 方法進(jìn)行綁定
  }
})


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)