2024-06-28 15:13:20 +08:00
|
|
|
|
// 导入button组件
|
|
|
|
|
import mButton from './Button/src/index.vue'
|
|
|
|
|
import mButton1 from './Button1/src/index.vue'
|
|
|
|
|
|
|
|
|
|
// 组件列表
|
|
|
|
|
const components = [
|
|
|
|
|
mButton,mButton1
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// 定义 install 方法,接收 Vue 作为参数(使用 use 注册插件,那么所有的组件都会被注册)
|
|
|
|
|
const install = function (Vue) {
|
|
|
|
|
// 判断是否安装
|
|
|
|
|
if (install.installed) return
|
|
|
|
|
// 遍历注册全局组件
|
|
|
|
|
components.map(component => Vue.component(component.name, component))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否是直接引入文件
|
|
|
|
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
|
|
|
install(window.Vue)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
|
|
|
|
|
install,
|
|
|
|
|
}
|
2024-06-29 19:31:28 +08:00
|
|
|
|
export {
|
|
|
|
|
install,mButton,mButton1
|
|
|
|
|
}
|