- 在根目录下创建components文件夹,定义全局组件,组件名建议xxx-功能.vue,例如safe-scrollbox.vue
- 注册为全局组件(page.json)
"easycom": {
"autoscan": true, //是否开启自动扫描,开启后将会自动扫描符合components/组件名称/组件名称.vue目录结构的组件
"safe-(.*)": "@/components/safe-$1.vue", // 匹配components目录下组件名称/组件名称内的vue文件
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
- 页面内使用
<safe-scrollbox @lowerFun="lowerFun" @refreshFun="refreshFun" :otherHeight="otherHeight"
_type="nodata" :list="sealListArr" :status="loadStatus" :isRefresh="isRefresh" bgColor="#fff">
<view class="seal-list-container" slot="contBox">
<sealList @showActionBox="showActionBox" :list="sealListArr" :loadings="loadings"></sealList>
</view>
</safe-scrollbox>
