uni-app 头条小程序引用组件问题

uni-app 头条小程序引用组件问题

开发环境 版本号 项目创建方式
Windows win10 HBuilderX
## 示例代码:

```vue
<template>  
    <view class="content">  
        <test></test>  
    </view>  
</template>  

<script>  
    import test from "@/components/test/test.vue"  
    export default {  
        components:{  
            test  
        }  
    }  
</script>  
<!-- test -->  
<template>  
    <view>  

    </view>  
</template>  

<script>  
    export default {  
        name:"test",  
        data() {  
            return {  

            };  
        },  
        created() {  
            console.log('组件被创建');  
        },  
    }  
</script>  

操作步骤:

  • 引用组件

预期结果:

  • 组件创建一次

实际结果:

  • 组件创建多次

bug描述:

页面引用组件时组件被多次创建


更多关于uni-app 头条小程序引用组件问题的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部