vue2.0(新手)第一个坑--do not mount Vue to <body>!!!
来源:互联网 发布:网络十大神豪 编辑:程序博客网 时间:2024/06/14 03:32
转载自:http://blog.csdn.net/wmwmdtt/article/details/53589662
这是vue2.0的最新写法,我们看到的是vue项目的主入口main.js,template是将会替换el的挂载元素的模板
区别一定是:el对应的 一定是一个css选择器,如果还是html 或者body元素,如下图:
浏览器将会报错:
,google translate:
不要将Vue挂载到<html>或<body> - mount到普通元素。
官方文档是这么解释的:
提供的元素只能作为挂载点。不同于 Vue 1.x,所有的挂载元素会被 Vue 生成的 DOM 替换。因此不推荐挂载root实例到 <html>
或者 <body>
上。
阅读全文
0 0
- vue2.0(新手)第一个坑--do not mount Vue to <body>!!!
- vue2.0(新手)第一个坑--do not mount Vue to <body>!!!
- vue2.0错误:Do not mount Vue to <html> or <body>
- Vue2+Webpack错误:Do not mount Vue to <html> or <body>
- Do not mount Vue to <html> or <body>
- Do not mount Vue to <html> or <body>
- vue2.0新手填坑攻略之使用vue-cli搭建vue项目开发环境到项目发布
- Vue2+Webpack报错:Failed to mount component: template or render function not defined.
- Abstract methods do not specify a body
- [Vue warn]: Failed to mount component: template or render function not defined. (found in root insta
- Vue2.0 新手安装攻略
- vue2.0路由--vue-router
- vue2.0,vue-router配置
- vue2.0使用vue-router
- Vue2.0配置vue-router
- Vue2.0+Vue-cli脚手架
- 第一个Hello Vue!
- Whonix - Things NOT to do
- C++模板实现顺序队列
- mysql数据向Redis快速导入
- How to install PicOS in Edgecore-5712-54X
- code-push-server的部署(源码)
- redis密码管理
- vue2.0(新手)第一个坑--do not mount Vue to <body>!!!
- LeetCode Print Binary Tree
- 计算机语言发展史
- Android-->ConstraintLayout解读
- Codis集群的搭建与使用
- Linux-HA开源软件Heartbeat(安装篇)
- Redis修改配置没有效果处理
- ios HTTP 同步 异步请求
- Linux-HA开源软件Heartbeat(配置篇)