forked from didi/mand-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
225 lines (215 loc) · 4.54 KB
/
index.js
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* eslint comma-dangle: ["error", "always-multiline"] */
// Import components core
import './_style/global.styl'
import {transformCamelCase, warn} from './_util'
import Button from './button'
import Icon from './icon'
import Popup from './popup'
import PopupTitleBar from './popup-title-bar'
import ActionBar from './action-bar'
import ActionSheet from './action-sheet'
import DropMenu from './drop-menu'
import Picker from './picker'
import Selector from './selector'
import Swiper from './swiper'
import SwiperItem from './swiper-item'
import Toast from './toast'
import Tip from './tip'
import Tabs from './tabs'
import TabPane from './tab-pane'
import TabBar from './tab-bar'
import Tag from './tag'
import InputItem from './input-item'
import Stepper from './stepper'
import Steps from './steps'
import NoticeBar from './notice-bar'
import ImageReader from './image-reader'
import ImageViewer from './image-viewer'
import NumberKeyboard from './number-keyboard'
import Landscape from './landscape'
import ResultPage from './result-page'
import TabPicker from './tab-picker'
import Dialog from './dialog'
import Field from './field'
import FieldItem from './field-item'
import CellItem from './cell-item'
import Switch from './switch'
import Agree from './agree'
import Radio from './radio'
import RadioList from './radio-list'
import DatePicker from './date-picker'
import Captcha from './captcha'
import Codebox from './codebox'
import Cashier from './cashier'
import Chart from './chart'
import Amount from './amount'
import ActivityIndicator from './activity-indicator'
import Check from './check'
import CheckBox from './check-box'
import CheckGroup from './check-group'
import CheckList from './check-list'
import ScrollView from './scroll-view'
import ScrollViewRefresh from './scroll-view-refresh'
import ScrollViewMore from './scroll-view-more'
import Bill from './bill'
import WaterMark from './water-mark'
import Transition from './transition'
import DetailItem from './detail-item'
import Slider from './slider'
import Progress from './progress'
import Ruler from './ruler'
/* @init<%import ${componentNameUpper} from './${componentName}'%> */
// Totally importing reminder
warn(
'You are using a whole package of mand-mobile, ' +
'please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.',
'warn',
)
/* global MAN_VERSION */
const version = /* @echo MAN_VERSION */ MAN_VERSION
export const components = {
Button,
Icon,
Popup,
PopupTitleBar,
ActionBar,
ActionSheet,
DropMenu,
Picker,
Selector,
TabBar,
Swiper,
SwiperItem,
Tip,
Tabs,
Tag,
InputItem,
Stepper,
Steps,
NoticeBar,
ImageReader,
ImageViewer,
NumberKeyboard,
Landscape,
ResultPage,
TabPicker,
Dialog,
Field,
FieldItem,
CellItem,
Switch,
Agree,
Radio,
RadioList,
DatePicker,
Captcha,
Codebox,
Cashier,
Chart,
Amount,
ActivityIndicator,
Check,
CheckBox,
CheckGroup,
CheckList,
ScrollView,
ScrollViewRefresh,
ScrollViewMore,
Bill,
WaterMark,
TabPane,
Transition,
DetailItem,
Slider,
Progress,
Ruler,
/* @init<%${componentNameUpper},%> */
}
// Define plugin installation method
const install = function(Vue) {
if (!Vue || install.installed) {
return
}
// Register global components
const componentsNames = Object.keys(components)
componentsNames.forEach(name => {
const component = components[name]
if (component.name) {
Vue.component(component.name, component) // kebab-case
Vue.component(transformCamelCase(`-${component.name}`), component) // PascalCase
}
})
// Mount to prototype
Vue.prototype.$toast = Toast
Vue.prototype.$dialog = Dialog
Vue.prototype.$actionsheet = ActionSheet
}
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue)
}
// xport components
export {
install,
version,
Button,
Icon,
Popup,
PopupTitleBar,
ActionBar,
ActionSheet,
DropMenu,
Picker,
Selector,
TabBar,
Swiper,
SwiperItem,
Toast,
Tip,
Tabs,
Tag,
InputItem,
Stepper,
Steps,
NoticeBar,
ImageReader,
ImageViewer,
NumberKeyboard,
Landscape,
ResultPage,
TabPicker,
Dialog,
Field,
FieldItem,
CellItem,
Switch,
Agree,
Radio,
RadioList,
DatePicker,
Captcha,
Codebox,
Cashier,
Chart,
Amount,
ActivityIndicator,
Check,
CheckBox,
CheckGroup,
CheckList,
ScrollView,
ScrollViewRefresh,
ScrollViewMore,
Bill,
WaterMark,
TabPane,
Transition,
DetailItem,
Slider,
Progress,
Ruler,
/* @init<%${componentNameUpper},%> */
}
export default {
install,
version,
}