Skip to content

Commit 6170778

Browse files
committed
fix(link): only warn if "tag" or "event" is used
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)
1 parent 711315e commit 6170778

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/link.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ export default {
132132
}
133133

134134
if (process.env.NODE_ENV !== 'production') {
135-
if (this.tag && !warnedTagProp) {
135+
if ('tag' in this.$options.propsData && !warnedTagProp) {
136136
warn(
137137
false,
138138
`<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.`
139139
)
140140
warnedTagProp = true
141141
}
142-
if (this.event && !warnedEventProp) {
142+
if ('event' in this.$options.propsData && !warnedEventProp) {
143143
warn(
144144
false,
145145
`<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.`

0 commit comments

Comments
 (0)