index.js 1.16 KB
/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: limin
 * @Date: 2021-09-21 10:36:52
 * @LastEditors: limin
 * @LastEditTime: 2021-09-24 18:37:14
 * @FilePath: \npm\glsx-components\src\index.js
 */
// import _Vue from 'vue'
// const GLComponents = {}
// const componentsFiles = require.context(`./components`, true, /.vue|js$/)
// GLComponents.install = Vue => {
//   if (!Vue) {
//     window.Vue = Vue = _Vue
//   }
//   componentsFiles.keys().forEach(path => {
//     const component = componentsFiles(path).default
//     Vue.component(component.name, component)
//   })
// }
// export default GLComponents


/**
 * 仅用于本地测试 npm run serve
 */
import Vue from 'vue'
import GLButton from './packages/Button'
const componentsFiles = require.context(`./packages`, true, /\.vue$/)
componentsFiles.keys().forEach(path => {
  const component = componentsFiles(path).default
  // console.log('component: ', component);
  Vue.component(component.name, component)
})

//函数组件
const permissions = {
  routes: [
    { path: '/', meta: { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] } },
    { path: '/a', meta: {} }
  ],
  routerBase: ''
}
Vue.use(GLButton, permissions)