index.js
5.42 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import Affix from './components/affix';
import Alert from './components/alert';
import Anchor from './components/anchor';
import AnchorLink from './components/anchor-link';
import AutoComplete from './components/auto-complete';
import Avatar from './components/avatar';
import BackTop from './components/back-top';
import Badge from './components/badge';
import Breadcrumb from './components/breadcrumb';
import Button from './components/button';
import Card from './components/card';
import Calendar from './components/calendar';
import Carousel from './components/carousel';
import Cascader from './components/cascader';
import Cell from './components/cell';
import Checkbox from './components/checkbox';
import Circle from './components/circle';
import Collapse from './components/collapse';
import ColorPicker from './components/color-picker';
import Content from './components/content';
import DatePicker from './components/date-picker';
import Divider from './components/divider';
import Drawer from './components/drawer';
import Dropdown from './components/dropdown';
import Footer from './components/footer';
import Form from './components/form';
import Header from './components/header';
import Icon from './components/icon';
import Input from './components/input';
import InputNumber from './components/input-number';
import Scroll from './components/scroll';
import Split from './components/split';
import Layout from './components/layout';
import LoadingBar from './components/loading-bar';
import Menu from './components/menu';
import Message from './components/message';
import MewMap from './components/mew-map';
import MewMapSelector from './components/mew-map-selector';
import Modal from './components/modal';
import Notice from './components/notice';
import Page from './components/page';
import Poptip from './components/poptip';
import Progress from './components/progress';
import Radio from './components/radio';
import Rate from './components/rate';
import Sider from './components/sider';
import Slider from './components/slider';
import Spin from './components/spin';
import Steps from './components/steps';
import Switch from './components/switch';
import Table from './components/table';
import Tabs from './components/tabs';
import Tag from './components/tag';
import Time from './components/time';
import Timeline from './components/timeline';
import TimePicker from './components/time-picker';
import Tooltip from './components/tooltip';
import Transfer from './components/transfer';
import Tree from './components/tree';
import Upload from './components/upload';
import {Row, Col} from './components/grid';
import {Select, Option, OptionGroup} from './components/select';
import locale from './locale/index';
const components = {
Affix,
Alert,
Anchor,
AnchorLink,
AutoComplete,
Avatar,
BackTop,
Badge,
Breadcrumb,
BreadcrumbItem: Breadcrumb.Item,
Button,
ButtonGroup: Button.Group,
Calendar,
Card,
Carousel,
CarouselItem: Carousel.Item,
Cascader,
Cell,
CellGroup: Cell.Group,
Checkbox,
CheckboxGroup: Checkbox.Group,
Col,
Collapse,
ColorPicker,
Content: Content,
DatePicker,
Divider,
Drawer,
Dropdown,
DropdownItem: Dropdown.Item,
DropdownMenu: Dropdown.Menu,
Footer: Footer,
Form,
FormItem: Form.Item,
Header: Header,
Icon,
Input,
InputNumber,
Scroll,
Sider: Sider,
Split,
Submenu: Menu.Sub,
Layout: Layout,
LoadingBar,
Menu,
MenuGroup: Menu.Group,
MenuItem: Menu.Item,
Message,
MewMap,
MewMapSelector,
Modal,
Notice,
Option: Option,
OptionGroup,
Page,
Panel: Collapse.Panel,
Poptip,
Progress,
Radio,
RadioGroup: Radio.Group,
Rate,
Row,
Select,
Slider,
Spin,
Step: Steps.Step,
Steps,
Table,
Tabs: Tabs,
TabPane: Tabs.Pane,
Tag,
Time,
Timeline,
TimelineItem: Timeline.Item,
TimePicker,
Tooltip,
Transfer,
Tree,
Upload
};
const iview = {
...components,
iButton: Button,
iCircle: Circle,
iCol: Col,
iContent: Content,
iForm: Form,
iFooter: Footer,
iHeader: Header,
iInput: Input,
iMenu: Menu,
iOption: Option,
iProgress: Progress,
iSelect: Select,
iSwitch: Switch,
iTable: Table,
iTime: Time
};
const install = function(Vue, opts = {}) {
if (install.installed) return;
locale.use(opts.locale);
locale.i18n(opts.i18n);
Object.keys(iview).forEach(key => {
Vue.component(key, iview[key]);
});
Vue.prototype.$IVIEW = {
size: opts.size || '',
transfer: 'transfer' in opts ? opts.transfer : ''
};
Vue.prototype.$Loading = LoadingBar;
Vue.prototype.$Message = Message;
Vue.prototype.$Modal = Modal;
Vue.prototype.$Notice = Notice;
Vue.prototype.$Spin = Spin;
};
// auto install
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
const API = {
version: process.env.VERSION, // eslint-disable-line no-undef
locale: locale.use,
i18n: locale.i18n,
install,
Circle,
Switch,
...components
};
API.lang = (code) => {
const langObject = window['iview/locale'].default;
if (code === langObject.i.locale) locale.use(langObject);
else console.log(`The ${code} language pack is not loaded.`); // eslint-disable-line no-console
};
module.exports.default = module.exports = API; // eslint-disable-line no-undef