mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
add dynamic global component registration
This commit is contained in:
parent
19ae0ccada
commit
19d3e58d3f
3 changed files with 7 additions and 12 deletions
|
@ -1,5 +0,0 @@
|
||||||
export { default as FormItemHelper } from './FormItemHelper'
|
|
||||||
|
|
||||||
export { default as InputItem } from './InputItem'
|
|
||||||
export { default as SelectItem } from './SelectItem'
|
|
||||||
export { default as CheckboxItem } from './CheckboxItem'
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { default as Icon } from './Icon'
|
|
||||||
export { default as Breadcrumb } from './Breadcrumb'
|
|
||||||
export { FormItemHelper, InputItem, SelectItem, CheckboxItem } from './formItems'
|
|
|
@ -6,17 +6,20 @@ import i18n from './i18n'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
|
||||||
import * as globalsComponents from './components/globals'
|
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
// Styles are imported in `src/App.vue` <style>
|
// Styles are imported in `src/App.vue` <style>
|
||||||
Vue.use(BootstrapVue)
|
Vue.use(BootstrapVue)
|
||||||
|
|
||||||
// Register global components
|
// Register global components
|
||||||
for (const component of Object.values(globalsComponents)) {
|
const requireComponent = require.context('@/components/globals', true, /\.(js|vue)$/i)
|
||||||
|
// For each matching file name...
|
||||||
|
requireComponent.keys().forEach((fileName) => {
|
||||||
|
// Get the component
|
||||||
|
const component = requireComponent(fileName).default
|
||||||
|
// Globally register the component
|
||||||
Vue.component(component.name, component)
|
Vue.component(component.name, component)
|
||||||
}
|
})
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
i18n,
|
i18n,
|
||||||
|
|
Loading…
Add table
Reference in a new issue