• npm地址

  • github源码

  • (五) 全局导出配置

    包括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组件用于按需加载
    }

    相关文章: