1.创建一个js文件,引入公共组件
import Spu from './ImageBig/index.vue'
import Sku from './XtxSku/index.vue'
export const componentPlus = {
// app.component('组件名',组件配置对象(引入时候的名))
install(app) {
app.component('Spu', sSpu)
app.component('Sku',Sku)
}
}
2.main.js,引入js文件并注册
// 进行引入
import { componentPlugin} from '@/components'
// 全局注册
app.use(componentPlugin)