第一步 在main.js里面 引入需要注册的组件例如:
//引入组件
import header from './components/header.vue'
import footer from './components/footer.vue'
// 注册全局组件
Vue.component('headerVue',header);
Vue.component('footerVue',footer);
第二步使用组件
在app.vue里面
<headerVue></headerVue>
<footerVue></footerVue> 或者以驼峰式写法调用
<header-vue></header-vue>
<footer-vue></footer-vue>