import Vue from 'vue' // 引入vue

function changeStr(str){
  return str.charAt(0).toUpperCase() + str.slice(1)
}

const requireComponent = require.context('../components', false, /\.vue$/)

requireComponent.keys().forEach(fileName => {
  const config = requireComponent(fileName)
  const componentName = changeStr(
    fileName.replace(/^\.\//, '').replace(/\.\w+$/, '')
  )

  Vue.component(componentName, config.default || config)
})
