【xingorg1-ui】基于vue3.0从0-1搭建组件库 (五) 组件包入口文件

(五) 全局导出配置

包括Button等单个组件的单独导出和整个组件库的默认导出

/*
 * @Author: your name
 * @Date: 2020-11-01 00:27:12
 * @LastEditTime: 2020-11-01 11:13:49
 * @LastEditors: @Guojufeng
 * @Description: In User Settings Edit
 * @FilePath: /Users/guojufeng/Documents/GitHub/xingorg1-ui/packages/index.js
 */

import GjfButton from './src/button.vue'
const components = [
  GjfButton
]
var install = (app, opts = {}) => {
  components.forEach(item => {
    app.component(item.name, item) // 注意这里
  })
  app.$prototype.$GJF = {
    size: opts.size || '',
    zIndex: opts.zIndex || 1000
  }
}
export default { // 全局导出
  version'1.0.0',
  install,
  GjfButton // 单独导出button组件用于按需加载
}
posted @ 2020-11-16 23:50  xing.org1^  阅读(304)  评论(0编辑  收藏  举报