uyet
uyet
  • 发布:2022-03-14 18:53
  • 更新:2022-03-14 20:40
  • 阅读:908

一个全新的项目,使用HBuilder X导入uni-search-bar插件后,在index.vue写组件报错

分类:uni-app

谷歌浏览器能显示出search组件,但是console报错信息:
[Vue warn]: Unknown custom element: <uni-section> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> at pages/index/index.vue

页面代码如下

<template>  
    <view class="content">  
        <uni-section title="自定义样式" subTitle="使用 bgColor 属性自定义背景色" type="line">  
            <uni-search-bar placeholder="自定义背景色" bgColor="#EEEEEE" @confirm="search" />  
        </uni-section>  
    </view>  
</template>  

<script>  
    export default {  

        data() {  
            return {  
                title: 'Hello'  
            }  
        },  
        onLoad() {  

        },  
        methods: {  
            search(res) {  
                uni.showToast({  
                    title: '搜索:' + res.value,  
                    icon: 'none'  
                })  
            }  
        }  
    }  
</script>  

<style>  
    page {  
        background-color: #f5f5f5;  
    }  
</style>  
2022-03-14 18:53 负责人:无 分享
已邀请:
DCloud_UNI_Anne

DCloud_UNI_Anne

请确保uni-search-bar组件、uni-section组件都存在,应该是没有uni-section组件导致的

  • 碌云

    uni-section从哪里引入?

    2022-04-24 18:46

  • DCloud_UNI_Anne

    回复 碌云: 导入uni-search-bar 搜索栏,完整示例项目里面有uni-section组件

    2022-04-24 19:29

  • 碌云

    回复 DCloud_UNI_Anne: 为什么官网把uni-section组件下架了。如果你们打算去除uni-section组件那我也没必要用啊,怕后面不兼容

    2022-04-24 19:32

该问题目前已经被锁定, 无法添加新回复