[Vue warn]: Do not mount Vue to <html> or <body> - mount to normal elements instead.
官方文档是这么解释的:
提供的元素只能作为挂载点。不同于 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.的更多相关文章
- "[Vue warn]: Failed to mount component: template or render function not defined"错误的解决
VUE中动态路由出错: vue.esm.js?a026: [Vue warn]: Failed to mount component: template or render function not ...
- [Vue warn]: Failed to mount component: template or render function not defined. 错误解决方法
解决方法import Vue from "vue"; 默认引入的文件是 vue/dist/vue.runtime.common.js.这个可以在node_modules/vue/p ...
- [Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined、vuejs路由使用的问题Error in render function
1.[Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined 注意,只要出现Error i ...
- 【js】vue 2.5.1 源码学习 (十) $mount 挂载函数的实现
大体思路(九) 本节内容: 1. $mount 挂载函数的实现. // 将Vue.prototype.$mount 缓存下来 ==>mountComponet(this,el) { // 组建挂 ...
- vue踩坑记录:[Vue warn]: $attrs is readonly.
今天在用element-ui的DatePicker日期选择器的时候,发现每当点击一次这个组件,控制台就会报警告`[Vue warn]: $attrs is readonly`,但是也不影响实际操作效果 ...
- vue.runtime.esm.js:593 [Vue warn]: Invalid prop: custom validator check failed for prop "value".报错解决
在uni中使用 picker组件,一直报错 vue.runtime.esm.js:593 [Vue warn]: Invalid prop: custom validator check failed ...
- [Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instanc
今天在使用vue框架搭建环境时,遇到这个错误提示: [Vue warn]: Attribute "id" is ignored on component <div> b ...
- [Vue warn]: Cannot find element: #main
使用vue框架的时候,如果页面提示如下错误,则说明new Vue的时候没有传入 el 的值: [Vue warn]: Cannot find element: #main 我们传入el 既可以,如: ...
- [Vue warn]: Error in render: "SyntaxError: Unexpected token ' in JSON at position 1"
一,场景: 字符串转对象: var str = "{'bankRate':5,'YINGUO':0}" 二,操作: JSON.parse(str)时候,报错 [Vue warn]: ...
随机推荐
- MathExam任务一
小学一二年级数学计算题 一.预估与实际 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 60 35 • Es ...
- 实验五Java网络编程及安全——20135337朱荟潼
实验五 Java网络编程及安全 结对伙伴:20135317韩玉琪(负责服务器方)http://www.cnblogs.com/hyq20135317/p/4567241.html 实验内容 1.掌握S ...
- 《[C#] int与System.Int32有什么区别》
最近园里的TeamOne写了一篇<[C#] int与System.Int32有什么区别>,发现里面有不少精彩的评论,所以忍不住想这篇文章总结一下:> 本文的主要参考资料: 1.< ...
- 【贪心算法】POJ-3190 区间问题
一.题目 Description Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one wil ...
- js获取浏览器窗口属性
网页可见区域宽: document.body.clientWidth;网页可见区域高: document.body.clientHeight;网页可见区域宽: document.body.offset ...
- Docker的volume机制实现容器数据的持久性存储
1:可以启动一个容器的时候,临时指定挂载的volume,这个volume会自动创建,无需在宿主机上事先创建 docker run -it -v /busybox busybox:latest 登入到b ...
- android自动化之appium的环境搭建
简介appium appium是C/S架构,appium的核心是一个web服务器,它提供了一套REST的接口,他会接收客户端的连接,监听到命令.执行会再将结果通过HTTP响应返还给客户端.ap ...
- vue 引入组件
<comA></comA>此时可用在模板里 //a为vue文件,里面定义了模板import comA from './components/a' export default ...
- 多线程-Thread的run()与start()的区别
总结: 1) start: 用start方法来启动线程,真正实现了多线程运行,这时无需等待run方法体代码执行完毕而直接继续执行下面的代码.通过调用Thread类的start()方法来启动一个线程,这 ...
- 【Java并发编程】之一:可重入内置锁
每个Java对象都可以用做一个实现同步的锁,这些锁被称为内置锁或监视器锁.线程在进入同步代码块之前会自动获取锁,并且在退出同步代码块时会自动释放锁.获得内置锁的唯一途径就是进入由这个锁保护的同步代码块 ...