index.js
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* @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)