I'd like to copy the content of this for-loop into clipboard:
<div ref="text" class="links">
<div class="row" v-for="(name, index) in resultNames" :key="index" >
<p>{{makeUrl(name)}} </p>
</div>
</div>
<button @click="handleCopy">Copy to Clipboard</button>
I followed this answer and came up with this method:
handleCopy() {
this.$refs.text.select();
document.execCommand('copy');
}
But this results in:
Uncaught TypeError: this.$refs.text.select is not a function
So I'm left clueless how can I solve this withouth using third party javascript plugins?
P.S. I tried some JS specific suggested answers, like this, but get error:
Uncaught TypeError: Failed to execute 'selectNode' on 'Range': parameter 1 is not of type 'Node'.