Skip to content

Commit

Permalink
fix(link): only warn if "tag" or "event" is used
Browse files Browse the repository at this point in the history
closes vuejs#3457
Only show deprecation warning if the props "tag" or "event" are actually passed by the consumer (key exists in propsData), not if they have any value at all (they always have a value since a default is specified in the props definition)
  • Loading branch information
jonaskuske committed Jan 26, 2021
1 parent 711315e commit 6170778
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/link.js
Expand Up @@ -132,14 +132,14 @@ export default {
}

if (process.env.NODE_ENV !== 'production') {
if (this.tag && !warnedTagProp) {
if ('tag' in this.$options.propsData && !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) {
if ('event' in this.$options.propsData && !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.`
Expand Down

0 comments on commit 6170778

Please sign in to comment.