转自: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. listening for variable changes in javascript

    https://stackoverflow.com/questions/1759987/listening-for-variable-changes-in-javascript

  2. 弱也有弱的ACM经历

    作为一名弱校的acm渣渣,在经历了三年的acm生涯后,现在终于要毕业了,最后也来总结下自己在这几年中做acm的经历与感受.以下是参赛总结: 2013年: ACM/ICPC长沙邀请赛(打铁=_=) AC ...

  3. DMABUFF

    1.DMABUF框架提供了在多设备间共享缓存的通用方法,支持DMABUF的设备驱动可以将一个DMA缓存以文件句柄的方式输出到用户空间(输出者规则),以文件句柄的方式从用户空间获取一个DMA缓存,这个文 ...

  4. 用户态监控网络接口up、down事件

    网上搜索(https://blog.csdn.net/qq123386926/article/details/50695725)可以直接使用netlink现成的接口实现: #include <s ...

  5. Javascript 在严格模式下禁止指向 this

    如下代码, f() 输出的是 false,而 f2() 输出的是 true. 这是因为 f2 在严格模式下禁止 this 指向全局,所以 this 是 undefined, !this 当然是 tru ...

  6. java 多线程之:join() 方法

    join()介绍 join() 定义在java.lang.Thread中. join() 的作用:让"主线程"等待"子线程"结束之后才能继续运行.

  7. sklearn, Numpy以及Pandas

    pandas里面的对于数据操作比如where,drop以及dropna等都会有一个属性:inplace,这个单词意思是原地,如果inplace=true代表数据本身要执行该操作:如果inplace=f ...

  8. Mybatis常见面试题 一

    1.#{}和${}的区别是什么? 注:这道题是面试官面试我同事的. 答:${}是Properties文件中的变量占位符,它可以用于标签属性值和sql内部,属于静态文本替换,比如${driver}会被静 ...

  9. C# webBrowser 获取元素class属性值

    // he 是HtmlElement对象 // GetAttribute("class") 一直取空值 he.GetAttribute("className")

  10. 杂项:MSMQ

    ylbtech-杂项:MSMQ MicroSoft Message Queuing(微软消息队列)是在多个不同的应用之间实现相互通信的一种异步传输模式,相互通信的应用可以分布于同一台机器上,也可以分布 ...