cube-ui
Version:
A fantastic mobile ui lib implement by Vue
137 lines (129 loc) • 1.84 kB
JavaScript
import {
/* eslint-disable no-unused-vars */
Style,
// locale
Locale,
// basic
Button,
Loading,
Tip,
Toolbar,
TabBar,
TabPanels,
// form
Checkbox,
CheckboxGroup,
Checker,
Radio,
RadioGroup,
Input,
Textarea,
Select,
Switch,
Rate,
Validator,
Upload,
Form,
// popup
Popup,
Toast,
Picker,
CascadePicker,
DatePicker,
TimePicker,
SegmentPicker,
Dialog,
ActionSheet,
Drawer,
ImagePreview,
// scroll
Scroll,
Slide,
IndexList,
Swipe,
Sticky,
ScrollNav,
ScrollNavBar,
RecycleList,
// module
BetterScroll,
createAPI
} from './module'
import { processComponentName } from './common/helpers/util'
const components = [
// locale
Locale,
// basic
Button,
Loading,
Tip,
Toolbar,
TabBar,
TabPanels,
// form
Checkbox,
CheckboxGroup,
Checker,
Radio,
RadioGroup,
Input,
Textarea,
Select,
Switch,
Rate,
Validator,
Upload,
Form,
// popup
Popup,
Toast,
Picker,
CascadePicker,
DatePicker,
TimePicker,
SegmentPicker,
Dialog,
ActionSheet,
Drawer,
ImagePreview,
// scroll
Scroll,
Slide,
IndexList,
Swipe,
Sticky,
ScrollNav,
ScrollNavBar,
RecycleList
]
function install(Vue) {
if (install.installed) {
return
}
install.installed = true
components.forEach((Component) => {
// ignore radio
if (Component === Radio) {
return
}
Component.install(Vue)
})
}
const Cube = {
/* eslint-disable no-undef */
version: '1.12.55',
install,
BScroll: BetterScroll,
createAPI
}
components.forEach((Component) => {
const name = processComponentName(Component, {
firstUpperCase: true
})
Cube[name] = Component
})
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(install)
}
export * from './module'
export default Cube