mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-27 01:56:15 -04:00
feat: added components
This commit is contained in:
parent
6e0c369398
commit
5fa81533d9
30 changed files with 2405 additions and 1853 deletions
20
mixins/copyable.mixin.ts
Normal file
20
mixins/copyable.mixin.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import {Component, Vue} from 'nuxt-property-decorator'
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@Component
|
||||
export class CopyableMixin extends Vue {
|
||||
copy(text: string, toastText = 'Copied to clipboard !') {
|
||||
copyToClipboard(text)
|
||||
console.log(toastText)
|
||||
this.$toast.success(toastText)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue