vue-cli中main.js详解

import Vue from ' vue '
import App from ' ./App '
import router from ' ./router '

Vue. config. productionTip = false

/* eslint-disable no-new */
new Vue({
el: ' #app ',
router,
components: { ' app ': App },
template: ' '
})

// template: ''相当于把id为app的元素替换成,然后又被识别为App组件,也就是App.vue,

当然也可以把放在index.html页面效果不同的是id元素没有被替换

你可能感兴趣的:(vue-cli中main.js详解)