I have been looking everywhere for a working example of how to connect an external JS file and call its function, but I haven't had any luck. Essentially, my goal is to link an external JavaScript file and execute its function using VueJS.
<script src="/static/medium-editor.min.js"></script>
<script>
export default {
name: 'App',
mounted: function() {
var editor = new MediumEditor('.editable', {
toolbar: {
buttons: ['bold', 'italic', 'underline', 'anchor']
}
});
console.log('testing...')
}
}
</script>
Although the file appears to be loading correctly, I keep encountering this error:
ReferenceError: MediumEditor is not defined
I've attempted to use import MediumEditor as well, but it seems we need to export it in the other JS file which hasn't worked either.
Just for context, I am trying to integrate this plugin into my VueJS test project: https://github.com/yabwe/medium-editor/blob/master/dist/js/medium-editor.js
If anyone has any insights on how to successfully call that external function within VueJS and make it functional, I would greatly appreciate it. I'm still learning, so any help would be invaluable. I've spent all day searching for a solution without any success.
Thank you in advance
Chandra
Update: I've included a JSFiddle link if you want to give it a try: https://jsfiddle.net/maharzan/nze45uxf/2/