官方文档是这么解释的:

提供的元素只能作为挂载点。不同于 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.的更多相关文章

  1. "[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 ...

  2. [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 ...

  3. [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 ...

  4. 【js】vue 2.5.1 源码学习 (十) $mount 挂载函数的实现

    大体思路(九) 本节内容: 1. $mount 挂载函数的实现. // 将Vue.prototype.$mount 缓存下来 ==>mountComponet(this,el) { // 组建挂 ...

  5. vue踩坑记录:[Vue warn]: $attrs is readonly.

    今天在用element-ui的DatePicker日期选择器的时候,发现每当点击一次这个组件,控制台就会报警告`[Vue warn]: $attrs is readonly`,但是也不影响实际操作效果 ...

  6. 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 ...

  7. [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 ...

  8. [Vue warn]: Cannot find element: #main

    使用vue框架的时候,如果页面提示如下错误,则说明new Vue的时候没有传入 el 的值: [Vue warn]: Cannot find element: #main 我们传入el 既可以,如: ...

  9. [Vue warn]: Error in render: "SyntaxError: Unexpected token ' in JSON at position 1"

    一,场景: 字符串转对象: var str = "{'bankRate':5,'YINGUO':0}" 二,操作: JSON.parse(str)时候,报错 [Vue warn]: ...

随机推荐

  1. 【Alpha】阶段第十次Scrum Meeting

    [Alpha]阶段第十次Scrum Meeting 工作情况 团队成员 今日已完成任务 明日待完成任务 刘峻辰 登出接口 编写后端说明文档 赵智源 编写脚本实现测试的持续集成 前测试点页面跳转逻辑测试 ...

  2. Java锁的种类以及辨析

    锁作为并发共享数据,保证一致性的工具,在JAVA平台有多种实现(如 synchronized 和 ReentrantLock等等 ) .这些已经写好提供的锁为我们开发提供了便利,但是锁的具体性质以及类 ...

  3. P4论文粗读笔记(一)

    一 文章名称:SNAP: Stateful Network-Wide Abstractions for Packet Processing 数据包处理的带状态网络概念 发表时间:2016 期刊来源:S ...

  4. Leetcode题库——8.字符串转为整数【##】

    @author: ZZQ @software: PyCharm @file: myAtoi.py @time: 2018/9/20 20:54 要求:实现 atoi,将字符串转为整数. 1)根据需要丢 ...

  5. java常见字符集

    ASCII 名称由来 ASCII(American Standard Code for Information Interchange,美国信息互换标准编码)是基于罗马字母表的一套电脑编码系统.[1] ...

  6. redux相关专业名词及函数提要

    redux: 用来管理react app 状态(state)的一个架构. store: 通过createStore()创建,用来存放state,与react app是完全分离的.createStore ...

  7. 全选练习-原生版和jQuery

    今天来做一些练习,做全选练习 原生版的实现: <!DOCTYPE html> <html> <head> <meta charset="UTF-8& ...

  8. PAT 1074 宇宙无敌加法器

    https://pintia.cn/problem-sets/994805260223102976/problems/994805263297527808 地球人习惯使用十进制数,并且默认一个数字的每 ...

  9. XMind2TestCase:一个高效测试用例设计的解决方案!

    一.背景 软件测试过程中,最重要.最核心就是测试用例的设计,也是测试童鞋.测试团队日常投入最多时间的工作内容之一. 然而,传统的测试用例设计过程有很多痛点: 1.使用Excel表格进行测试用例设计,虽 ...

  10. 图片上传预览,兼容IE

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...