This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2020-07-26 04:17:10 -07:00
|
|
|
<template>
|
|
|
|
<div class="input-group my-2">
|
|
|
|
<input class="form-control" readonly :value="link.replace('https://', '').replace('http://', '')" id="link" ref="link">
|
2021-10-27 12:00:45 -07:00
|
|
|
<button class="btn btn-outline-secondary" ref="clipboard" data-clipboard-target="#link" :data-clipboard-text="link" @click="focusLink" :aria-label="$t('crud.copy')" :title="$t('crud.copy')">
|
2021-01-22 14:54:24 -08:00
|
|
|
<Icon v="clipboard"/>
|
|
|
|
</button>
|
|
|
|
<a :href="link" target="_blank" rel="noopener" class="btn btn-outline-secondary">
|
|
|
|
<Icon v="external-link"/>
|
|
|
|
</a>
|
2020-07-26 04:17:10 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ClipboardJS from 'clipboard';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
link: { required: true },
|
|
|
|
},
|
|
|
|
mounted () {
|
2021-10-27 12:00:45 -07:00
|
|
|
new ClipboardJS(this.$refs.clipboard);
|
2020-07-26 04:17:10 -07:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
focusLink() {
|
|
|
|
setTimeout(_ => this.$refs.link.select(), 100);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|