mirror of
https://github.com/Luzifer/ots.git
synced 2025-08-13 16:35:37 -04:00
Port frontend to Bootstrap 5.3, split components
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
b8fd877654
commit
8c0807d486
14 changed files with 813 additions and 830 deletions
47
src/components/clipboard-button.vue
Normal file
47
src/components/clipboard-button.vue
Normal file
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<button
|
||||
v-if="hasClipboard"
|
||||
:class="{'btn': true, 'btn-primary': !copyToClipboardSuccess, 'btn-success': copyToClipboardSuccess}"
|
||||
:disabled="!content"
|
||||
@click="copy"
|
||||
>
|
||||
<i class="fas fa-clipboard" />
|
||||
</button>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
hasClipboard() {
|
||||
return Boolean(navigator.clipboard && navigator.clipboard.writeText)
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
copyToClipboardSuccess: false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
copy() {
|
||||
navigator.clipboard.writeText(this.content)
|
||||
.then(() => {
|
||||
this.copyToClipboardSuccess = true
|
||||
window.setTimeout(() => {
|
||||
this.copyToClipboardSuccess = false
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
name: 'AppClipboardButton',
|
||||
|
||||
props: {
|
||||
content: {
|
||||
default: null,
|
||||
required: false,
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue