11 months ago

How to manage your global Vue component?

Posted 11 months ago by zerogpm

whenever you add a new component, you will have to add that to app.js as the project grow, this app.js will grow so big. I am thinking to split those component code into other files. what is the best way to do that? Need some advices. Thank you

Vue.component('app', require('./components/addNumber/App'));
Vue.component('shopping', require('./components/shop/Shopping'));
Vue.component('sum', require('./components/addNumber/Sum'));
Vue.component('number', require('./components/addNumber/Number'));
Vue.component('add-number', require('./components/addNumber/AddNumber'));
Vue.component('products', require('./components/shop/products'));
Vue.component('product', require('./components/shop/product'));
Vue.component('mini-cart', require('./components/shop/MiniCart'));
Vue.component('sort', require('./components/shop/Sort'));


This code can go on.

Please sign in or create an account to participate in this conversation.