[Vuejs]-How to import vuejs component dependencies in a MPA?

0👍

I would highly recommend using vue-cli, but if for some reason that is not possible, then I believe,though I have never tried it, you would basically need to add all your components and code into a single long js file, or include them in the right order in your html documents.

Certain component libraries can work this way, like vuetify. You simply include the whole vuetify.js file after vue.js and then you can use all the components available.

I think it would be quite a lot of work to do anything of much size, but if it is something really small you could add components in the following manner, one after another.

var componentTemplate = 
     `
         // Template code..
    `; 

Vue.component('my-cool-component', {
    template: componentTemplate, 
    data: function() {
           return {
              //
           }
       }
});

Leave a comment