Skip to content

Commit d2cb951

Browse files
committed
feat(link): warn deprecated props
1 parent ceeda4c commit d2cb951

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/components/link.js

+19
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const eventTypes: Array<Function> = [String, Array]
1212
const noop = () => {}
1313

1414
let warnedCustomSlot
15+
let warnedTagProp
16+
let warnedEventProp
1517

1618
export default {
1719
name: 'RouterLink',
@@ -128,6 +130,23 @@ export default {
128130
}
129131
}
130132

133+
if (process.env.NODE_ENV !== 'production') {
134+
if (this.tag && !warnedTagProp) {
135+
warn(
136+
false,
137+
`<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.`
138+
)
139+
warnedTagProp = true
140+
}
141+
if (this.event && !warnedEventProp) {
142+
warn(
143+
false,
144+
`<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.`
145+
)
146+
warnedEventProp = true
147+
}
148+
}
149+
131150
if (this.tag === 'a') {
132151
data.on = on
133152
data.attrs = { href, 'aria-current': ariaCurrentValue }

0 commit comments

Comments
 (0)