const app = createApp({
name: 'MyApp',
data() {},
...
})
// 相当于 Vue2
const vm = new Vue({
name: 'App',
...
})
app.component
返回 app 实例app.component
返回 undefined// Vue2.0
Vue.component();
// Vue3.0
const app = createApp(App);
app.component('组件名', 组件对象); // 全局注册
#app
)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')
Vue2.0
中的 Vue.prototype.$http =
全局挂载utils/index.js
function add(a, b) {
return a + b;
}
export {
add
}
main.js