UNPKG

ck-plus

Version:

vite制作npm包

22 lines (19 loc) 517 B
import Button from "../components/button/index.vue"; const components = [Button]; const install = function (Vue) { if (install.installed) return; install.installed = true; // 遍历并注册全局组件 components.map((component) => { Vue.component(component.name, component); }); }; if (typeof window !== "undefined" && window.Vue) { install(window.Vue); } export default { // 导出的对象必须具备一个 install 方法 install, // 组件列表 ...components, };