I have integrated a feature in my Laravel/Vue application where users can copy a link by clicking on an icon.
Currently, my component includes the following code:
<a href="sample.site" class="text-dark" target="_blank" rel="noopener noreferrer" ref="mylink">
<img class="social_icon" @click="copyURL($refs.mylink)"
src="/images/game/copy.png"
/></a>
<p>copied: {{ link }}</p>
In my script, I have the following:
<script>
export default {
};
const app = new Vue({
el: '#app',
data() {
return {
link: ''
}
},
methods: {
copyURL(link) {
this.link = link.href
}
}
})
</script>
Despite implementing this code, the functionality is not working as expected and there are no visible errors present.