createApp 创建 App 实例

const app = createApp({
  name: 'MyApp',
  data() {},
  ...
})

// 相当于 Vue2
const vm = new Vue({
  name: 'App',
  ...
})

app.component

// Vue2.0
Vue.component();

// Vue3.0
const app = createApp(App);
app.component('组件名', 组件对象); // 全局注册

app.mount

app.unmount

app.config

import { createApp } from 'vue'
import App from './App_Lifecycle_onRenderTracked_onRenderTriggered.vue'

const app = createApp(App)
console.log('app:', app);
console.log('app.config:', app.config);
app.mount('#app')

Untitled

⭐️ app.config.globalProperties

utils/index.js

function add(a, b) {
  return a + b;
}

export {
  add
}

main.js