I am currently working on a project that involves using Laravel and Vue.js. In order to incorporate an image editing package called "photojshop" into my Vue component, I tried the following approach:
<template>
<img src=".." id="myImg" >
</templete>
<script>
import $ from 'jquery'
export default {
data: () => ({
......data of your component
}),
mounted() {
let recaptchaScript = document.createElement('script')
recaptchaScript.setAttribute('src', 'my local js file')
document.head.appendChild(recaptchaScript)
},
methods: {
EditImage(){
$('myImg').photoJshop({ .... }) (error)
}
}
}
</script>
However, when trying to execute the function $('..').photoJshop({})
, I encountered an error stating that the function is not defined (photoJshop).