thedesk/src/components/_globals.ts

16 lines
468 B
TypeScript
Raw Normal View History

'use strict'
2019-04-22 18:39:16 +09:00
import Vue from 'vue'
2019-04-10 00:26:04 +09:00
import { upperFirst, camelCase } from 'lodash'
2019-04-10 00:26:04 +09:00
const requireComponent = require.context('./globals', false, /Base[A-Z]\w+\.(vue|js)$/)
requireComponent.keys().forEach((fileName: string) => {
const componentConfig = requireComponent(fileName)
const componentName = upperFirst(
camelCase(
fileName.replace(/^\.\/(.*)\.\w+$/, '$1')
)
)
Vue.component(componentName, componentConfig.default || componentConfig)
})