relax-vue-ui
Version:
基于element-ui二次封装的组件库
32 lines (26 loc) • 776 B
JavaScript
import Components from '../packages/index'
import Directives from './directives/index'
import PACKAGE from "../package.json";
const { version } = PACKAGE
const install = function (Vue, option = {}) {
if (!option.components) {
Components.componentsInstall(Vue)
}else{
Array.isArray(option.components) && Components.componentsInstall(Vue,option.components)
}
if(!option.directives){
Directives.directivesInstall(Vue)
}else{
Array.isArray(option.directives) && Directives.directivesInstall(Vue,option.directives)
}
}
// 判断是否是直接引入文件
if (typeof window !== "undefined" && window.Vue) {
install(window.Vue);
}
export default {
version,
install,
...Components,
...Directives
}