1.创建index.js
import Head from '../views/Home/head'
import Foot from '../views/Home/foot'
const components = {
Head,
Foot
}
const customizeUI = {
install (Vue) {
for (const key in components) {
Vue.component(components[key].name, components[key])
}
}
}
export default customizeUI
2.main.js引入
import customizeUI from './components/index'
Vue.use(customizeUI)
vue全局组件注册
最新推荐文章于 2024-10-02 15:35:50 发布