码迷,mamicode.com
首页 > Web开发 > 详细

[Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.

时间:2018-02-13 22:15:26      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:2.0   htm   normal   生成   bsp   项目   一个   code   temp   

官方文档是这么解释的:

提供的元素只能作为挂载点。不同于 Vue 1.x,所有的挂载元素会被 Vue 生成的 DOM 替换。因此不推荐挂载root实例到 <html> 或者 <body> 上。

这是vue2.0的最新写法,我们看到的是vue项目的主入口main.js,template是将会替换el的挂载元素的模板

区别一定是:el对应的 一定是一个css选择器,如果还是html 或者body元素,浏览器将会报错:

[Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.

[Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.

标签:2.0   htm   normal   生成   bsp   项目   一个   code   temp   

原文地址:https://www.cnblogs.com/xiangxinhouse/p/8447488.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!