Files
manja_ui_dev/Vue_Starter/src/components/SidebarNavLink.vue
T
xidedix 683cf9bb92 Update to v1.0.6
- refactor: raw html to b-row, b-col, b-card, b-button components
- fix: Cards change variant="accent- to class="card-accent-
- refactor: Modal's ok-button variants
- refactor: forms with validation feedback
- update: bootstrap-vue to 1.1.0 closes #28
- update: to vue 2.5.6

from build v1.0.5
- update: bootstrap-vue to 1.0.x
- fix: use <b-form-radio-group> instead of <b-form-radio>
- refactor: <b-table> bootstrap-vue component in Tables closes #24
- refactor: extract Table component from Tables
- refactor: <b-table> bootstrap-vue component in Switches
- fix: add table-responsive-sm class to Tables closes #26
- refactor: use component <b-navbar-nav> instead of deprecated prop is-nav-bar
- fix: b-progress height property workaround (bootstrap-vue)
- chore: dependencies update
2017-11-21 18:31:46 +01:00

69 lines
1.4 KiB
Vue

<template>
<div v-if="isExternalLink">
<a :href="url" :class="classList">
<i :class="icon"></i> {{name}}
<b-badge v-if="badge && badge.text" :variant="badge.variant">{{badge.text}}</b-badge>
</a>
</div>
<div v-else>
<router-link :to="url" :class="classList">
<i :class="icon"></i> {{name}}
<b-badge v-if="badge && badge.text" :variant="badge.variant">{{badge.text}}</b-badge>
</router-link>
</div>
</template>
<script>
export default {
name: 'sidebar-nav-link',
props: {
name: {
type: String,
default: ''
},
url: {
type: String,
default: ''
},
icon: {
type: String,
default: ''
},
badge: {
type: Object,
default: () => {}
},
variant: {
type: String,
default: ''
},
classes: {
type: String,
default: ''
}
},
computed: {
classList () {
return [
'nav-link',
this.linkVariant,
...this.itemClasses
]
},
linkVariant () {
return this.variant ? `nav-link-${this.variant}` : ''
},
itemClasses () {
return this.classes ? this.classes.split(' ') : []
},
isExternalLink () {
if (this.url.substring(0, 4) === 'http') {
return true
} else {
return false
}
}
}
}
</script>