Skip to content

Commit

Permalink
feat(link): warn deprecated props
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jan 5, 2021
1 parent ceeda4c commit d2cb951
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/link.js
Expand Up @@ -12,6 +12,8 @@ const eventTypes: Array<Function> = [String, Array]
const noop = () => {}

let warnedCustomSlot
let warnedTagProp
let warnedEventProp

export default {
name: 'RouterLink',
Expand Down Expand Up @@ -128,6 +130,23 @@ export default {
}
}

if (process.env.NODE_ENV !== 'production') {
if (this.tag && !warnedTagProp) {
warn(
false,
`<router-link>'s tag prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link.`
)
warnedTagProp = true
}
if (this.event && !warnedEventProp) {
warn(
false,
`<router-link>'s event prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link.`
)
warnedEventProp = true
}
}

if (this.tag === 'a') {
data.on = on
data.attrs = { href, 'aria-current': ariaCurrentValue }
Expand Down

0 comments on commit d2cb951

Please sign in to comment.