import Vue from 'vue'

// 引入svg
const requireAll = requireContext => requireContext.keys().map(requireContext);
const req = require.context('../assets/icon', false, /\.svg$/);
requireAll(req)


// 引入mescroll.js
import MescrollVue from "mescroll.js/mescroll.vue";
Vue.component('mescroll-vue', MescrollVue)

// 引入瀑布流
import WaterFall from "vue-waterfall2"
Vue.use(WaterFall)


// vant组件按需引入
import {
    Button,
    Image,
    Popup,
    Toast,

    Checkbox,
    Picker,
    Stepper,
    Switch,
    Uploader,

    Dialog,
    PullRefresh,
    SwipeCell,


    CountDown,
    List,
    Sticky,
    Progress,
    Skeleton,
    Swipe,
    SwipeItem,

    Tab,
    Tabs,
    ImagePreview 
} from 'vant'

Vue.use(Button)
Vue.use(Image)
Vue.use(Popup)
Vue.use(Toast)

Vue.use(Checkbox)
Vue.use(Picker)
Vue.use(Stepper)
Vue.use(Switch)
Vue.use(Uploader)

Vue.use(CountDown)
Vue.use(List)
Vue.use(Sticky)
Vue.use(Progress)
Vue.use(Skeleton)
Vue.use(Swipe)
Vue.use(SwipeItem)

Vue.use(Dialog)
Vue.use(PullRefresh)
Vue.use(SwipeCell)

Vue.use(Tab)
Vue.use(Tabs)
Vue.use(ImagePreview)
import { Image as VanImage } from 'vant';
Vue.use(VanImage);
Vue.prototype.$showLoading = message => { Toast.loading({ message, forbidClick: true, duration: 0 }) }
Vue.prototype.$hideLoading = Toast.clear
Vue.prototype.$showSuccess = Toast.success
Vue.prototype.$showFail = Toast.fail

// 自定义组件
import "./m-components"