[Vuejs]-Function is not define

0👍

This might be happening because of the following:

  • The verbatims.js file is not loading in the browser because of
    wrong path.
  • The verbatims.js file that reached the browser does
    not contain your class.
  • You did not import the Verbatims class on the referencing script.

Fix for 3rd option should be like this:

 <script type="module">
  import {Verbatims} from './src/vebatim.js';

   ....ommitted for brevity

  changeNbRequest = function() {
            var timer = setInterval(function() {
                let verbatim = new Verbatims().list()[ite];
            }, 5000);
  }
 </script>

Additional TIP

To improve your code, try to place all the JS code inside your index.html to an external file so you can take advantage of ES6 import/export features.

Leave a comment