main.uts 1.2 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
import App from './App.uvue'

import { createSSRApp, reactive } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  app.config.globalProperties.globalPropertiesStr = 'default string'
  app.config.globalProperties.globalPropertiesNum = 0
  app.config.globalProperties.globalPropertiesBool = false
  app.config.globalProperties.globalPropertiesObj = {
    str: 'default globalProperties obj string',
    num: 0,
    bool: false,
  }
  app.config.globalProperties.globalPropertiesNull = null as string | null
  app.config.globalProperties.globalPropertiesArr = [] as number[]
  app.config.globalProperties.globalPropertiesSet = new Set<string>()
  app.config.globalProperties.globalPropertiesMap = new Map<string, number>()
  app.config.globalProperties.globalPropertiesReactiveObj = reactive({
    str: 'default reactive string',
    num: 0,
    bool: false,
  })
  app.config.globalProperties.globalPropertiesFn = () : string => {
    console.log('this.globalPropertiesStr', this.globalPropertiesStr)
    console.log('this.globalPropertiesNum', this.globalPropertiesNum)
    return `globalPropertiesStr: ${this.globalPropertiesStr}, globalPropertiesNum: ${this.globalPropertiesNum}`
  }

  return {
    app
  }
fxy060608's avatar
fxy060608 已提交
32
}