// main.js
store.dispatch('getUserInfo').then(() => {
// 创建了APP应用,然后挂载到id=app的元素上,并使用了store和router。
// store,router 成了全局的啦,this.$store.xxx;this.$router.xxx
instance = new Vue({
el: '#app',
router,
store,
template: '<App/>',
components: { App }
});
}).catch(utils.handlePromiseRejection);
- index.html -->main.js;
- main.js 挂载了app.vue; app.vue 的template 替换index,html 中的 <div id="app">;
- app.vue 的template 包含
(1)dom啥的
(2)router 对应的组件渲染到router-view中