0👍
Make a js file with this content in your components folder:
import Vue from 'vue'
const requireComponent = require.context('@/components', true, /\.vue$/)
requireComponent.keys().forEach(fileName => {
const componentConfig = requireComponent(fileName)
const componentName = fileName
.replace(/^\.\//, '')
.replace(/\.\w+$/, '')
.replace(/\//g, '-')
.toLowerCase()
Vue.component(componentName, componentConfig.default || componentConfig)
})
then simply import that in your layout .vue file.
- [Vuejs]-Why my global style and js files inside nuxt.config.js doesn't work?
- [Vuejs]-How to append input values to a list in Ionic App (VueJS)?
Source:stackexchange.com