[Vuejs]-Script src with vue.js doesn't work

0👍

It is something like that :

   document.addEventListener('load', function() {
   var app = new Vue({
     el: '#app',
         data: {
         message: 'Hello Vue!'
          },
         methods: {
           loadJs(url, callback) {
             jQuery.ajax({
               url: url,
               dataType: 'script',
               success: callback,
               async: true
             });
           }
         },
         mounted() {
           this.loadJs('myvuefile.js', 
        function() {
             //Stuff to do after someScript has loaded
           });

Leave a comment