You've already forked random-web-tools
Add copy invisible character tool
This commit is contained in:
44
src/views/general/CopyInvisibleCharacter.vue
Normal file
44
src/views/general/CopyInvisibleCharacter.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<h2 class="tool-title">Copy invisible character</h2>
|
||||
<hr class="mt-5 mb-5" />
|
||||
|
||||
<div class="input-group">
|
||||
<label for="result">Result</label>
|
||||
<div>
|
||||
<input
|
||||
id="result"
|
||||
class="input"
|
||||
:value="toolResult"
|
||||
type="text"
|
||||
readonly
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mt-3">
|
||||
<button @click="copyResult" class="btn">{{ toolData.btnName }}</button>
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
toolData: {
|
||||
btnName: 'Copy',
|
||||
},
|
||||
toolResult: ``,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async copyResult() {
|
||||
document.getElementById("result").select();
|
||||
navigator.clipboard?.writeText(this.toolResult);
|
||||
document.execCommand('copy');
|
||||
|
||||
this.toolData.btnName = 'Copied!';
|
||||
setTimeout(() => this.toolData.btnName = 'Copy', 500);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user