From 617077847c58cf15ffff946fb9817820b79da279 Mon Sep 17 00:00:00 2001 From: Jonas Kuske <30421456+jonaskuske@users.noreply.github.com> Date: Tue, 26 Jan 2021 04:08:22 +0100 Subject: [PATCH] fix(link): only warn if "tag" or "event" is used closes #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) --- src/components/link.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/link.js b/src/components/link.js index a84e10ed5..9c2a25784 100644 --- a/src/components/link.js +++ b/src/components/link.js @@ -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, `'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, `'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.`