index.ts 572 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1
import { ComponentPublicInstance } from 'vue'
fxy060608's avatar
fxy060608 已提交
2 3 4 5 6 7 8 9 10 11
import { initOn } from './on'
import { initSubscribe } from './subscribe'

export function initService() {
  if (__NODE_JS__) {
    return
  }
  initOn()
  initSubscribe()
}
fxy060608's avatar
fxy060608 已提交
12 13 14 15 16 17 18 19 20 21

export function initAppVm(appVm: ComponentPublicInstance) {
  appVm.$vm = appVm
  appVm.$mpType = 'app'
}

export function initPageVm(
  pageVm: ComponentPublicInstance,
  page: Page.PageInstance['$page']
) {
fxy060608's avatar
fxy060608 已提交
22
  pageVm.route = page.route
fxy060608's avatar
fxy060608 已提交
23 24 25 26 27
  pageVm.$vm = pageVm
  pageVm.$page = page
  pageVm.$mpType = 'page'
  pageVm.__isTabBar = page.meta.isTabBar!
}