uniapp中引入公共组件

1、在目录component中写了一个组件
Footer.vue

<template>
    <view class="footer">
    </view>
</template>

2、在index.vue中引入Footer组件 并在实例中注册

import Footer from '../components/footer.vue' 
components:{  
     Footer
}

页面中引用

<view class="content">      
    <view class="icon">
    </view>
    <Footer></Footer>
</view>

猜你喜欢

转载自www.cnblogs.com/gwkzb/p/13383733.html