feat: first tool base

This commit is contained in:
Corentin Thomasset 2021-02-06 11:14:28 +01:00
parent b0e232bc77
commit 02dafd6a2f
No known key found for this signature in database
GPG key ID: DBD997E935996158
15 changed files with 326 additions and 168 deletions

18
mixins/copyable.ts Normal file
View 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)
}
}
}