mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 16:56:14 -04:00
feat: first tool base
This commit is contained in:
parent
b0e232bc77
commit
02dafd6a2f
15 changed files with 326 additions and 168 deletions
18
mixins/copyable.ts
Normal file
18
mixins/copyable.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
const copyToClipboard = (text: string) => {
|
||||
const input = document.createElement('textarea')
|
||||
input.innerHTML = text
|
||||
document.body.appendChild(input)
|
||||
input.select()
|
||||
const result = document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
return result
|
||||
}
|
||||
|
||||
export const copyable = {
|
||||
methods: {
|
||||
copy(text: string, toastText = 'Copied to clipboard !') {
|
||||
copyToClipboard(text)
|
||||
this.$toast.success(toastText)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue