use link instead of url, do not use v-model, use value to not allow mutate prop

This commit is contained in:
Ulf Gebhardt 2022-04-21 13:22:52 +02:00
parent 00e03af7f3
commit f9efc3fa06
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="clipboard-copy"> <div class="clipboard-copy">
<b-input-group size="lg" class="mb-3" prepend="Link"> <b-input-group size="lg" class="mb-3" prepend="Link">
<b-form-input v-model="url" type="text" readonly></b-form-input> <b-form-input :value="link" type="text" readonly></b-form-input>
<b-input-group-append> <b-input-group-append>
<b-button size="sm" text="Button" variant="success" @click="CopyLink"> <b-button size="sm" text="Button" variant="success" @click="CopyLink">
{{ $t('gdd_per_link.copy') }} {{ $t('gdd_per_link.copy') }}
@ -16,15 +16,10 @@ export default {
props: { props: {
link: { type: String, required: true }, link: { type: String, required: true },
}, },
data() {
return {
url: `${this.link}`,
}
},
methods: { methods: {
CopyLink() { CopyLink() {
navigator.clipboard navigator.clipboard
.writeText(this.url) .writeText(this.link)
.then(() => { .then(() => {
this.toastSuccess(this.$t('gdd_per_link.link-copied')) this.toastSuccess(this.$t('gdd_per_link.link-copied'))
}) })