From d2cb9519f3d7d8f31b12c211f5617b9afa0da870 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 5 Jan 2021 11:37:05 +0100 Subject: [PATCH] feat(link): warn deprecated props --- src/components/link.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/components/link.js b/src/components/link.js index ec724ba97..6eeb1bd94 100644 --- a/src/components/link.js +++ b/src/components/link.js @@ -12,6 +12,8 @@ const eventTypes: Array = [String, Array] const noop = () => {} let warnedCustomSlot +let warnedTagProp +let warnedEventProp export default { name: 'RouterLink', @@ -128,6 +130,23 @@ export default { } } + if (process.env.NODE_ENV !== 'production') { + if (this.tag && !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) { + 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.` + ) + warnedEventProp = true + } + } + if (this.tag === 'a') { data.on = on data.attrs = { href, 'aria-current': ariaCurrentValue }