import 'babel-polyfill'
import 'swiper/dist/css/swiper.css'
import 'weui'

import Toast from './toast'
import Loading from './loading'
import Message from './message'
import Confirm from './confirm'

import AcButtonGroup from './button-group/index'
import AcButton from './button/index'
import AcInput from './input/index'
import AcContainer from './container'
import AcHeader from './header'
import AcMain from './main'
import AcFooter from './footer'
import AcSwiper from './swiper'
import AcCarousel from './carousel'
import AcCart from './cart'
import AcTabbar from './tabbar'
import AcTabbarItem from './tabbar-item'
import AcProgress from './progress'
import AcModal from './modal'
import AcInputNumber from './input-number'
import { Card, CardItem, CardPrefix, CardBody } from './card'

const components = [
  AcButton,
  AcButtonGroup,
  AcInput,
  AcSwiper,
  AcCarousel,
  AcCart,
  AcContainer,
  AcHeader,
  AcMain,
  AcFooter,
  AcTabbar,
  AcTabbarItem,
  AcProgress,
  AcModal,
  AcInputNumber,
  Card,
  CardItem,
  CardPrefix,
  CardBody
]

/**
 * 添加 install 方法
 * @param {*} Vue
 */
const install = function (Vue) {
  components.map(component => Vue.component(component.name, component))

  Vue.prototype.$toast = Toast.installToast
  Vue.prototype.$loading = Loading.installLoading
  Vue.prototype.$message = Message.installMessage
  Vue.prototype.$confirm = Confirm.installConfirm
}

export default install
