Skip to content

Commit d29e11f

Browse files
authored
Merge pull request #300 from dnum-mi/fix/dsfr-tag-href-to
fix: 🐛 Corrige DsfrTag : link permet de mettre soit to soit href
2 parents 3e808d4 + e0ae581 commit d29e11f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/components/DsfrTag/DsfrTag.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ export default defineComponent({
4343
linkComponent () {
4444
return '$nuxt' in this ? 'nuxt-link' : 'router-link'
4545
},
46-
to () {
47-
return this.isExternalLink ? undefined : this.link
48-
},
49-
href () {
50-
return this.isExternalLink ? this.link : undefined
46+
linkProps () {
47+
return { [this.isExternalLink ? 'href' : 'to']: this.link }
5148
},
5249
},
5350
})
@@ -57,13 +54,12 @@ export default defineComponent({
5754
<component
5855
:is="is"
5956
class="fr-tag"
60-
:to="to"
6157
:disabled="disabled"
62-
:href="href"
6358
:class="{
6459
'fr-tag--sm': small,
6560
}"
6661
:aria-pressed="selected"
62+
v-bind="linkProps"
6763
>
6864
<VIcon
6965
v-if="icon"

src/demo-app/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ const navItems = [
176176
value="OK"
177177
>
178178
</form>
179+
180+
<DsfrTag v-bind="{ component: 'DsfrTag', label: 'Label de l’étiquette', tagName: 'TagCand', small: 'small', link: '/profil/creation' }" />
179181
</div>
180182

181183
<DsfrModal

0 commit comments

Comments
 (0)