转自:https://blog.csdn.net/linyeban/article/details/54629869

学习vue的时候,刚开始按照官网的例子敲写,却出现以下的问题:

问题:这是因为你的js在html页面头部引入的原因,自定义js文件要最后引入,因为要先有元素id,vue才能获取相应的元素

正确的的代码:

<!DOCTYPE html>
<htmllang="en"xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <metacharset="UTF-8">
    <title>nihao</title>
</head>
<body>
<divid="app">
    {{ message }}
</div>
<scriptsrc="vue.js"></script>
<script src="index.js"></script><!--这里自定js文件要在最后引入。-->
</body>
</html>

[Vue warn]: Cannot find element: #app的更多相关文章

  1. Vue报错 [Vue warn]: Cannot find element

    在前端开发全面进入前端的时代 作为一个合格的前端开发工作者 框架是不可或缺的Vue React Anguar 作为前端小白,追随大佬的脚步来到来到博客园,更新现在正在学习的Vue 注 : 相信学习Vu ...

  2. vue报错[Vue warn]: Unknown custom element: <router-Link> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

    vue浏览器报错,如下 vue.runtime.esm.js?2b0e:619 [Vue warn]: Unknown custom element: <router-Link> - di ...

  3. [Vue warn]: Unknown custom element: <sapn> - did you register the component correctly? For recursive components, make sure to provide the "name" option. found in ---> <Evaluate> at src/views/index/

    关于vue报错: [Vue warn]: Unknown custom element: <sapn> - did you register the component correctly ...

  4. Vue报错之" [Vue warn]: Unknown custom element: <wzwzihello> - did you register the component correctly? For recursive components, make sure to provide the "name" option."

    一.报错截图 [Vue warn]: Unknown custom element: <wzwzihello> - did you register the component corre ...

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

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

  6. [Vue warn]: Unknown custom element: <terminal-process> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

    Vue组件注册报错问题 import 不要加{},排查出如果页面引用单个组件的时候不要加上{}中括号,引入多个组件时才能派上用场,中括号去除问题即可解决.

  7. vue components registration & vue error & Unknown custom element

    vue components registration & vue error & Unknown custom element vue.esm.js:629 [Vue warn]: ...

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

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

随机推荐

  1. 【多线程学习笔记整理】002_线程的停止、暂停、与yield

    一.停止线程的三种方式 停止线程是多线程中的一个很重要的点,停止线程意味着在线程处理完当前任务之前终止正在做的操作,但是如果不能正确的操作,可能会发生不可预期的结果. 1)使用退出标志,使线程正常退出 ...

  2. sql server CLR

    1. 配置sql server 启用CLR 在SQL Server2005/2008里面,CLR默认是关闭的.可以使用如下SQL语句开启CLR. sp_configure 'show advanced ...

  3. .net 拆分字符串成数数组 包含使用空格 逗号 回车 换行符等

    简单的代码如下: public static string[] GetProductList(string inputstring)        {            char[] split ...

  4. 用zcat查看压缩日志中百度抓取的量

    比如查看124.251.44.85这一台服务器的07-13,07-14,07-15的日志中百度抓取http://www.baidu.com/search/spider.html 的量 wc命令参考博客 ...

  5. linux的性能优化

    转一位大神的笔记. linux的性能优化: 1.CPU,MEM 2.DISK--RAID 3.网络相关的外设,网卡 linux系统性能分析: top:linux系统的负载,CPU,MEM,SWAP,占 ...

  6. java 多线程之:synchronized

    synchronized原理 在java中,每一个对象有且仅有一个同步锁.这也意味着,同步锁是依赖于对象而存在. 当我们调用某对象的synchronized方法时,就获取了该对象的同步锁.例如,syn ...

  7. php curl伪造来源ip和refer实例代码

    php curl伪造来源ip和来路refer实例代码1: //随机IP function Rand_IP(){ $ip2id= round(rand(600000, 2550000) / 10000) ...

  8. Servlet和JSP比较

    1. 两者哟许多相似之处,都可以生成动态网页 2. JSP的优点是擅长于网页制作,生成动态页面,比较直观. JSP的缺点是不容易跟踪与拍错 3. Servlet是纯Java语言,擅长流程处理和业务逻辑 ...

  9. Linux(Centos7)下安装 zookeeper docker版 集群

    为了省去麻烦的软件安装,现在开发环境需要的软件越来越习惯于docker安装了,先看下安装后的截图,开发环境正在启动的容器 1.首先系统需要先支持docker …… 由于之前安装几次都没有做流程记录,在 ...

  10. 获取post发送过来的xml包

     if (Request.HttpMethod.ToLower() == "post") { byte[] ar; ar = new byte[this.Request.Input ...