C
C
chincharovpc2019-04-07 21:36:31
Vue.js
chincharovpc, 2019-04-07 21:36:31

Vuejs components in a Laravel project. How to register components locally?

To register components on Laravel, I describe them in app.js in the components folder.

Vue.component('main-component', require('./components/Main.vue').default);
Vue.component('page-component', require('./components/MainComponents/Page.vue').default);
Vue.component('human-component', require('./components/MainComponents/PageComponents/Human.vue').default);
Vue.component('addhuman-component', require('./components/MainComponents/PageComponents/HumanComponents/AddHuman.vue').default);

Did I register them locally or globally?
When I open the main page, will they all be loaded immediately or only after they are called?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Popov, 2019-04-07
@chincharovpc

Yes, globally. Local registration - inside the component. Looks like this.

<script>
    export default {
        name: "card",
        components: {
            'card': require('./card.vue'),
        },
...
</spript>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question