import Vue from 'vue'
// import Page from '../Base/Page/index.vue'
// import Table from '../Base/Table/index.vue'
// import Dialog from '../Base/Dialog/index.vue'
// import Title from '../Base/Title/index.vue'
// import ImagePreview from '../Base/Dialog/ImagePreview.vue'
import { upperFirst, camelCase } from 'lodash'
// Vue.component('tf-page', Page)
// Vue.component(`tf-table`, Table)
// Vue.component(`tf-dialog`, Dialog)
// Vue.component(`tf-title`, Title)
// Vue.component(`tf-image-preview`, ImagePreview)
const requireComponent = require.context('@/components/Base', true, /\.vue$/)

export default {
  install(vue: typeof Vue): void {
    requireComponent.keys().forEach((fileName) => {
      const componentConfig = requireComponent(fileName)
      const component = componentConfig.default || componentConfig
      const componentName = upperFirst(camelCase(component.options.name))
      // console.log(componentName, component)
      vue.component(componentName, component)
    })
  }
}
