You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
923 B
49 lines
923 B
6 years ago
|
<template>
|
||
|
<component :is="tag"
|
||
|
@click.native="hideSidebar"
|
||
|
v-bind="$attrs"
|
||
|
tag="li">
|
||
|
<a class="nav-link">
|
||
|
<slot>
|
||
|
<i v-if="link.icon" :class="link.icon"></i>
|
||
|
<p>{{link.name}}</p>
|
||
|
</slot>
|
||
|
</a>
|
||
|
</component>
|
||
|
</template>
|
||
|
<script>
|
||
|
export default {
|
||
|
inheritAttrs: false,
|
||
|
inject: {
|
||
|
autoClose: {
|
||
|
default: true
|
||
|
}
|
||
|
},
|
||
|
props: {
|
||
|
link: {
|
||
|
type: [String, Object],
|
||
|
default: () => {
|
||
|
return {
|
||
|
name: '',
|
||
|
path: '',
|
||
|
icon: ''
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
tag: {
|
||
|
type: String,
|
||
|
default: 'router-link'
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
hideSidebar () {
|
||
|
if (this.autoClose && this.$sidebar && this.$sidebar.showSidebar === true) {
|
||
|
this.$sidebar.displaySidebar(false)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
<style>
|
||
|
</style>
|