在使用 vue-cli 构建项目时(使用的模版是webpack)
初始化的 main.js 中是这样的。
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
});
然后将挂载点改为: el: 'body'
,然后浏览器就会报这个警告:
[Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.
原因: