vue js copy text to clipboard
methods: {
copyURL() {
var Url = this.$refs.mylink;
Url.innerHTML = window.location.href;
console.log(Url.innerHTML)
Url.select();
document.execCommand("copy");
}
}
vue js copy text to clipboard
methods: {
copyURL() {
var Url = this.$refs.mylink;
Url.innerHTML = window.location.href;
console.log(Url.innerHTML)
Url.select();
document.execCommand("copy");
}
}
vue clipboard example
<button @click.prevent="handlerCopyText">
<input id="copyText" v-model="copyMessage" type="hidden" />
<img src="~/assets/svg/copy-link.svg" alt="" srcset="" class="object-contain max-h-10 mx-auto" />
<div class="text-center text-sm text-gray-900">Salin tautan</div>
</button>
<script>
handlerCopyText() {
const copyText = document.querySelector('#copyText')
copyText.setAttribute('type', 'text')
copyText.select()
const successful = document.execCommand('copy')
if (successful) {
this.copySuccess = successful
this.copyMessage = `${window.location.href}`
setTimeout(() => {
this.copySuccess = false
}, 800)
}
copyText.setAttribute('type', 'hidden')
window.getSelection().removeAllRanges()
}
</script>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us