I'm working on a Laravel and Vue application, and I've created a component that allows users to copy text to the clipboard when they click on a link. This is how it's implemented:
<a @click="copyURL" ref="mylink">
<img class="social_icon"
src="/images/game/copy.png"
/></a>
<input type="text" class="copyurl_txt"
value="https://sample.site/" ref="text"></input>
Within the script
section, I have included the following functionality:
<script>
export default {
methods: {
copyURL() {
this.$refs.text.select();
document.execCommand('copy');
alert('link copied');
}
},
};
</script>
Now, instead of using an alert box to display the "link copied" message, I want to figure out how to display it in a div or as a flash message. Any suggestions on how to achieve this?