forked from roach-php/roach-php.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeaderNavLink.vue
More file actions
44 lines (39 loc) · 859 Bytes
/
HeaderNavLink.vue
File metadata and controls
44 lines (39 loc) · 859 Bytes
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
44
<script lang="ts">
import Vue, { PropType } from "vue";
export interface HeaderNavLink {
label: string;
to: string;
external?: boolean;
}
export default Vue.extend({
props: {
link: Object as PropType<HeaderNavLink>,
},
render(h) {
const classes =
"font-medium text-gray-700 rounded-md py-2 px-3 current:bg-cyan-400 hover:bg-cyan-400 current:text-white hover:text-white text-sm";
if (this.link.external) {
return h(
"a",
{
attrs: {
href: this.link.to,
target: "_blank",
rel: "noreferrer noopener",
},
staticClass: classes,
},
this.link.label
);
}
return h(
"NuxtLink",
{
props: { to: this.link.to },
staticClass: classes,
},
this.link.label
);
},
});
</script>