feat: component base

This commit is contained in:
Corentin Thomasset 2021-02-13 19:55:45 +01:00
parent 02dafd6a2f
commit 6e0c369398
No known key found for this signature in database
GPG key ID: DBD997E935996158
17 changed files with 1482 additions and 1006 deletions

View file

@ -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)
}
}