uniapp:[Vue warn]: Failed to mount component: template or render function not defined. found in

简介: uniapp:[Vue warn]: Failed to mount component: template or render function not defined. found in

在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>
相关文章
|
4月前
|
JavaScript
Vue的vant notify组件报错Notify is not defined
Vue的vant notify组件报错Notify is not defined
|
4月前
vue3配置路由报错Catch all routes (“*“) must now be defined using a param with a custom regexp.
vue3配置路由报错Catch all routes (“*“) must now be defined using a param with a custom regexp.
122 0
|
1月前
|
存储 自然语言处理 JavaScript
vue中template到VDOM发生了什么
vue中template到VDOM发生了什么
vue中template到VDOM发生了什么
|
29天前
|
开发框架 小程序
uniApp——Eslint报错'uni' is not defined
uniApp——Eslint报错'uni' is not defined
34 0
|
2月前
|
JavaScript 定位技术
【天地图】vue 天地图 T is not defined
【天地图】vue 天地图 T is not defined
100 1
|
3月前
|
SQL 分布式计算 大数据
MaxCompute操作报错合集之遇到报错"ODPS-0130071:[1,8] Semantic analysis exception - class Ssf for user defined function ansy_xx cannot be loaded from any resources",该怎么办
MaxCompute是阿里云提供的大规模离线数据处理服务,用于大数据分析、挖掘和报表生成等场景。在使用MaxCompute进行数据处理时,可能会遇到各种操作报错。以下是一些常见的MaxCompute操作报错及其可能的原因与解决措施的合集。
209 5
|
2月前
|
JavaScript
Eslint-------error ‘Vue‘ is not defined no-undef
Eslint-------error ‘Vue‘ is not defined no-undef
|
4月前
|
设计模式 JavaScript 前端开发
Vue3报错Property “xxx“ was accessed during render but is not defined on instance
Vue3报错Property “xxx“ was accessed during render but is not defined on instance
|
4月前
|
DataWorks 数据管理 大数据
DataWorks操作报错合集之DataWorksUDF 报错:evaluate for user defined function xxx cannot be loaded from any resources,该怎么处理
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
77 0
|
4月前
|
JavaScript 前端开发 API
Vue中的render函数和template渲染原理有什么不同?
Vue中的render函数和template渲染原理有什么不同?
112 0