Skip to content

Commit b7f8879

Browse files
authored
chore(tab): deprecate use of href prop (#2944)
1 parent a798fb7 commit b7f8879

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/components/tabs/tab.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import idMixin from '../../mixins/id'
2+
import warn from '../../utils/warn'
23
import { requestAF } from '../../utils/dom'
34

5+
const DEPRECATED_MSG = 'Setting prop "href" is deprecated. Use the <b-nav> component instead'
6+
47
// @vue/component
58
export default {
69
name: 'BTab',
@@ -60,7 +63,10 @@ export default {
6063
// <b-nav> + <b-card> + <router-view>/<nuxt-child> should be used instead
6164
// And we dont support router-links here
6265
type: String,
63-
default: '#'
66+
default: '#',
67+
// deprecated: means don't use this prop
68+
// deprecation: refers to a change in prop usage
69+
deprecated: DEPRECATED_MSG
6470
},
6571
lazy: {
6672
type: Boolean,
@@ -128,6 +134,11 @@ export default {
128134
mounted() {
129135
// Initially show on mount if active and not disabled
130136
this.show = this.localActive
137+
// Deprecate use of `href` prop
138+
if (this.href && this.href !== '#') {
139+
/* istanbul ignore next */
140+
warn(`b-tab: ${DEPRECATED_MSG}`)
141+
}
131142
},
132143
updated() {
133144
// Force the tab button content to update (since slots are not reactive)

0 commit comments

Comments
 (0)