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
46
47
48
import Code from './code'
import Confirm from './confirm'
import DistPicker from './dist-picker'
import FileUpload from './file-upload'
import ImageUpload from './Image-upload'
import ImageUploadMultiple from './Image-upload/multiple'
import ImageView from './image-view'
import RadioGroup from './radio-group'
import Select from './select'
import StatusIndicator from './status-indicator'
import SwitchButton from './switch-button'
import TreeSelect from './tree-select'
const components = {
Code,
Confirm,
DistPicker,
FileUpload,
ImageUpload,
ImageUploadMultiple,
ImageView,
RadioGroup,
Select,
StatusIndicator,
SwitchButton,
TreeSelect
}
// 给组件库配置install方法
const install = function (Vue, opts = {}) {
Object.values(components).forEach(component => {
// 组件前缀
const prefix = opts.name || 'eagle'
// 配置组件名称
const name = prefix + component.name
// 给每个子组件配置install方法
component.install = function (Vue) {
Vue.component(name, component)
}
// 将每个子组件注册为全局组件
Vue.component(name, component)
})
}
export default {
install,
...components
}