-
Notifications
You must be signed in to change notification settings - Fork 179
/
cv-side-nav-link.vue
43 lines (41 loc) · 1014 Bytes
/
cv-side-nav-link.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
<li class="bx--side-nav__item">
<component
:is="tagType"
v-on="$listeners"
class="cv-side-nav-item-link bx--side-nav__link"
v-bind="{ ...$attrs, ...linkProps }"
:class="{ 'bx--side-nav__link--current': active }"
>
<cv-side-nav-icon v-if="hasNavIcon" small>
<slot name="nav-icon" />
</cv-side-nav-icon>
<cv-side-nav-link-text>
<slot />
</cv-side-nav-link-text>
</component>
</li>
</template>
<script>
import LinkMixin from '../../mixins/link-mixin';
import CvSideNavIcon from './cv-side-nav-icon';
import CvSideNavLinkText from './_cv-side-nav-link-text';
export default {
name: 'CvSideNavLink',
inheritAttrs: false,
mixins: [LinkMixin],
components: { CvSideNavIcon, CvSideNavLinkText },
props: {
active: Boolean,
icon: Object,
},
data() {
return {
hasNavIcon: this.$slots['nav-icon'],
};
},
beforeUpdate() {
this.hasNavIcon = !!this.$slots['nav-icon'];
},
};
</script>