[Vue warn]: Failed to mount component: template or render function not defined.解决方案

命名视图

vue router 里有一个 模式叫做 命名视图

本来一个页面里面只能有一个路由视图 对应 一个组件,现在可以多个路由视图 对应 多个组件。

出错点

点击标签之后,<router-view></router-view>中并没有内容出现。反而控制台中报错了。

原因

就是在写这里的时候,原来都是component,现在是components,多了一个s。

.

原文地址:https://www.cnblogs.com/jianxian/p/11063738.html

时间: 2024-08-01 00:06:32

[Vue warn]: Failed to mount component: template or render function not defined.解决方案的相关文章

Failed to mount component: template or render function not defined.

vue-loader13.0有一个变更就是默认启用了esModule 把vue-loader降至13.0以下,就可以解决 原文地址:https://www.cnblogs.com/qq364735538/p/9097157.html

[Vue warn]: Do not mount Vue to &lt;html&gt; or &lt;body&gt; - mount to normal elements instead.

官方文档是这么解释的: 提供的元素只能作为挂载点.不同于 Vue 1.x,所有的挂载元素会被 Vue 生成的 DOM 替换.因此不推荐挂载root实例到 <html> 或者 <body> 上. 这是vue2.0的最新写法,我们看到的是vue项目的主入口main.js,template是将会替换el的挂载元素的模板 区别一定是:el对应的 一定是一个css选择器,如果还是html 或者body元素,浏览器将会报错: 原文地址:https://www.cnblogs.com/xiang

[Vue warn]: Attribute &quot;id&quot; is ignored on component &lt;div&gt; because the component is a fragment instanc

今天在使用vue框架搭建环境时,遇到这个错误提示: [Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instanc 这个提示的原因是使用 vue-router 和 vue-loader 插件的时候在最外面那个 template 里面,所有内容的外面没有使用一个div包起来. 如果没有使用div或者其他的元素包起来,vue-router 跳

vue报错:[Vue warn]: Attribute &quot;id&quot; is ignored on component &lt;div&gt; because the component is a fragment instance

[Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance 今天自己做一个vue小项目的时候,老是报这个错误,百度之后解释是只能有一个最顶级的父元素,但是我最外层只用了一个div 出现fragment instance有多种情况: Template contains multiple top-level elements. (模版包

[Vue warn]: You may have an infinite update loop in a component render function

[Vue warn]: You may have an infinite update loop in a component render function 这个问题很奇怪,之前从来没有遇到过.如果是我自己主导的项目,倒也好办,慢慢 debug 就是:偏偏在公司的项目里遇到这个问题,而公司项目的体系结构很复杂,我还没完全掌握.更恼火的是,因为体系复杂,debug 也非常困难,再加上尚无测试框架,这个难搞啊…… 好死不死的,当时是下午3.4点钟,正好到了肚饿的时刻,结果又落入低血糖状态,真是屋漏

vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

在.vue文件中引入了 element-ui 的 table 和 pagination 组件后,报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.[翻译:组件模板应该只包含一个根元素. 如果您在多个元素上使用v-if,请使用v-else-if来代替它们.] 报错文

Vue Element遇警告:[Vue warn]: Invalid prop: custom validator check failed for prop &quot;type&quot;.

更详细的信息如下: [Vue warn]: Invalid prop: custom validator check failed for prop "type". found in ---> <ElBadge> at packages/badge/src/main.vue <ElMenuItem> at packages/menu/src/menu-item.vue <ElMenu> at packages/menu/src/menu.vue

- Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead. 解决方案

<template> <div>{{hello}}</div> <button @click="addOne">add one</button> <button @click="minusOne">minus one</button> </template> 在*.vue组件里有这么一段. 报错信息: (Emitted value instead of an instan

Vue.extend构造器和$mount实例构造组件后可以用$destroy()进行卸载,$forceUpdate()进行更新,$nextTick()数据修改

html <div id="app"> </div> <p><button onclick="destroy()">卸载</button></p> <p><button onclick="reload()">刷新</button></p> <p><button onclick="tick()"