// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import MintUI from 'mint-ui'
import MuseUI from 'muse-ui'
import store from './store'
import 'mint-ui/lib/style.css'
import './assets/styles/iconfont.css'
import './permission'

// import "lib-flexible";

import '@/styles/reset.scss'
import '@/styles/variables.scss'
// import "@/styles/style.scss";
// eslint-disable-next-line import/no-duplicates
// import Vant from "vant";
// import "vant/lib/index.css";
// import "vant/lib/icon/local.css";
// import '@/styles/vant-css/index.css'
// import "@/styles/media.scss";
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import pinyin from 'js-pinyin'
// import "./libs/rem.js";
// import "./libs/dpr.js";
import {
  DropdownMenu,
  DropdownItem,
  Tab,
  Tabs,
  Tag,
  TreeSelect,
  Area,
  Dialog,
  Popup,
  Cell,
  CellGroup,
  Picker,
  DatetimePicker,
  Icon,
  SwipeCell,
  Button,
  ActionSheet,
  List,
  Field,
  Tabbar,
  TabbarItem,
  Sticky,
  Checkbox,
  CheckboxGroup,
  Toast,
  Search,
  IndexBar,
  IndexAnchor,
  Swipe,
  SwipeItem,
  Col,
  Row,
  Switch,
  Uploader,
  Radio,
  RadioGroup,
  Overlay,
  Loading,
  Progress,
  Sidebar,
  SidebarItem,
  Stepper,
  Collapse,
  CollapseItem,
  Calendar,
  NoticeBar,
  NavBar,
  Badge
  // eslint-disable-next-line no-irregular-whitespace,import/no-duplicates
} from 'vant'
Vue.use(DropdownMenu)
  .use(DropdownItem)
  .use(Tab)
  .use(Tabs)
  .use(Dialog)
  .use(Tag)
  .use(TreeSelect)
  .use(Area)
  .use(Popup)
  .use(Cell)
  .use(CellGroup)
  .use(Picker)
  .use(DatetimePicker)
  .use(Icon)
  .use(SwipeCell)
  .use(Button)
  .use(ActionSheet)
  .use(List)
  .use(Field)
  .use(Tabbar)
  .use(TabbarItem)
  .use(Sticky)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(Toast)
  .use(Search)
  .use(IndexBar)
  .use(IndexAnchor)
  .use(Swipe)
  .use(SwipeItem)
  .use(Col)
  .use(Row)
  .use(Switch)
  .use(Uploader)
  .use(RadioGroup)
  .use(Radio)
  .use(Overlay)
  .use(Loading)
  .use(Progress)
  .use(Sidebar)
  .use(SidebarItem)
  .use(Stepper)
  .use(Collapse)
  .use(CollapseItem)
  .use(Calendar)
  .use(NoticeBar)
  .use(NavBar)
  .use(Badge)
// import "@/lib/flexible.js";

// main.js
// import 'lib-flexible'

// import { AlertPlugin, ToastPlugin } from 'vux'

// Vue.use(AlertPlugin)
// Vue.use(ToastPlugin)

Vue.use(MintUI)
Vue.use(MuseUI)
// Vue.use(Vant)
Vue.use(ElementUI)
// Vue.use(vant);
Vue.config.productionTip = false

/* eslint-disable no-new */
var vue = new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})
Vue.directive('loadmore', {
  bind (el, binding) {
    const selectWrap = el.querySelector('.el-table__body-wrapper')
    selectWrap.addEventListener('scroll', function () {
      let sign = 100
      const scrollDistance =
        this.scrollHeight - this.scrollTop - this.clientHeight
      if (scrollDistance <= sign) {
        binding.value()
      }
    })
  }
})

export default vue

// eslint-disable-next-line no-undef
