mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-25 09:16:15 -04:00
feat: component base
This commit is contained in:
parent
02dafd6a2f
commit
6e0c369398
17 changed files with 1482 additions and 1006 deletions
|
@ -1,3 +1,5 @@
|
|||
import {Component, Vue} from 'nuxt-property-decorator'
|
||||
|
||||
const copyToClipboard = (text: string) => {
|
||||
const input = document.createElement('textarea')
|
||||
input.innerHTML = text
|
||||
|
@ -8,11 +10,11 @@ const copyToClipboard = (text: string) => {
|
|||
return result
|
||||
}
|
||||
|
||||
export const copyable = {
|
||||
methods: {
|
||||
copy(text: string, toastText = 'Copied to clipboard !') {
|
||||
copyToClipboard(text)
|
||||
this.$toast.success(toastText)
|
||||
}
|
||||
@Component
|
||||
export class Copyable 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