microvideo-component
Version:
microvideo components
21 lines (16 loc) • 516 B
JavaScript
import { prefixName } from "../config";
const DEFAULT_NAME = prefixName.toUpperCase();
/**
* 注册组件 统一前缀
* @param {Array || Object} components 组件列表
* @param {Object} vue vue实例
* @returns
*/
export const installComponent = (components, vue) => {
if (!components || !vue) return;
const _components =
components.constructor === Object ? [components] : components;
_components.forEach((_component) => {
vue.component(DEFAULT_NAME + _component.name, _component);
});
};