uniapp:[Vue warn]: Failed to mount component: template or render function not de

简介: uniapp:[Vue warn]: Failed to mount component: template or render function not de

在uniapp 项目中,自定义组件,引入并使用自定义组件时出现了该报错,

image.png

解决方案: 当我仔细检查,原来是自定义组件时,命名时将"="等于号写成了":"冒号.

image.png

创建自定义组件


<template name="组件名称"> 
  <view>这是一个自定义组件</view> 
</template> 
<script> 
    export default { 
        name: "组件名称", 
        //属性 
        props: {  
            属性名称: {     
                type: String, 
                value: "值"  
            }
        }            
} 
</script> 
<style> 
</style> 


使用组件


<template>
  <view >
    <组件名称 组件属性="对应的值"></组件名称>
  </view>
</template>
<script>
import 组件名称 from "../../components/组件名.vue";
export default{
  components:{
    组件名称
  },
}
</script>
<style>
</style>




相关文章
|
8月前
|
iOS开发 开发者
uniapp开发ios打包Error code = -5000 Error message: Error: certificate file(p12) import failed!报错问题如何解决
uniapp开发ios打包Error code = -5000 Error message: Error: certificate file(p12) import failed!报错问题如何解决
475 67
uniapp开发ios打包Error code = -5000 Error message: Error: certificate file(p12) import failed!报错问题如何解决
|
存储 自然语言处理 JavaScript
vue中template到VDOM发生了什么
vue中template到VDOM发生了什么
vue中template到VDOM发生了什么
|
JavaScript 索引
Component name “index“ should always be multi-word vue/multi-word-component-names
Component name “index“ should always be multi-word vue/multi-word-component-names
|
JavaScript
error Component name “Login“ should always be multi-word vue/multi-word-component-names【已解决】
error Component name “Login“ should always be multi-word vue/multi-word-component-names【已解决】
1014 1
|
JavaScript
vue 动态组件【详解】component :is
vue 动态组件【详解】component :is
572 0
|
JavaScript 前端开发 编译器
Vue组件(Component)
Vue组件(Component)
170 3
|
JavaScript
Vue子组件调用父组件方法并传参的5种方式:$emit触发、传入子组件function、访问父组件$parent.function、用inject关联父组件provide的方法、用window.fun
Vue子组件调用父组件方法并传参的5种方式:$emit触发、传入子组件function、访问父组件$parent.function、用inject关联父组件provide的方法、用window.fun
Vue3 使用动态组件 component
Vue3 使用动态组件 component
450 0
|
JavaScript 前端开发 API
Vue中的render函数和template渲染原理有什么不同?
Vue中的render函数和template渲染原理有什么不同?
264 0
|
JavaScript 前端开发
[Vue Router warn]: Component “default“ in record with path “/xx“ is a function that does not return
[Vue Router warn]: Component “default“ in record with path “/xx“ is a function that does not return
1958 0