{"record":{"id":"251f03a9469c636d","repo":"vuejs/vue-router","slug":"router-link-with-to-this-to-is-trying-to-us","errorCode":null,"errorMessage":"<router-link> with to=\"${this.to}\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.","messagePattern":"<router-link> with to=\"(.+?)\" is trying to use a scoped slot but it didn't provide exactly one child\\. Wrapping the content with a span element\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/components/link.js","lineNumber":123,"sourceCode":"      this.$scopedSlots.default &&\n      this.$scopedSlots.default({\n        href,\n        route,\n        navigate: handler,\n        isActive: classes[activeClass],\n        isExactActive: classes[exactActiveClass]\n      })\n\n    if (scopedSlot) {\n      if (process.env.NODE_ENV !== 'production' && !this.custom) {\n        !warnedCustomSlot && warn(false, 'In Vue Router 4, the v-slot API will by default wrap its content with an <a> element. Use the custom prop to remove this warning:\\n<router-link v-slot=\"{ navigate, href }\" custom></router-link>\\n')\n        warnedCustomSlot = true\n      }\n      if (scopedSlot.length === 1) {\n        return scopedSlot[0]\n      } else if (scopedSlot.length > 1 || !scopedSlot.length) {\n        if (process.env.NODE_ENV !== 'production') {\n          warn(\n            false,\n            `<router-link> with to=\"${\n              this.to\n            }\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.`\n          )\n        }\n        return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)\n      }\n    }\n\n    if (process.env.NODE_ENV !== 'production') {\n      if ('tag' in this.$options.propsData && !warnedTagProp) {\n        warn(\n          false,\n          `<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.`\n        )\n        warnedTagProp = true\n      }","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/vuejs/vue-router/blob/680ccc68c506cca9be6207745043245d61fa715a/src/components/link.js#L105-L141","documentation":"This is a dev-only deprecation warning: the tag prop of <router-link> is removed in Vue Router 4 and will have no effect going forward. The recommended replacement is the v-slot API, which lets you render any element yourself. The warning fires once (warnedTagProp flag) when tag is found in the component's propsData.","triggerScenarios":"Passing tag=\"li\" (or any tag) to <router-link> in a project running a vue-router 3.x beta/next or 4.x-compatible dev build.","commonSituations":"Upgrading from vue-router 3.x stable (where tag worked) to the 3.x next / 4.x migration path; following old tutorials that style router-links as list items via tag.","solutions":["Remove the tag prop and use the v-slot API: <router-link custom v-slot=\"{ href, navigate }\"> and render your own element.","For list items, wrap: <li><router-link to=\"...\">...</router-link></li>, or use v-slot to render the <li> yourself with navigate on click.","Update styling/markup to target the rendered <a> instead of the custom tag."],"exampleFix":"// before\n<router-link to=\"/about\" tag=\"li\">About</router-link>\n// after\n<router-link to=\"/about\" custom v-slot=\"{ href, navigate }\">\n  <li :href=\"href\" @click=\"navigate\">About</li>\n</router-link>","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give <router-link> v-slot content exactly one root element.","Avoid comment nodes/fragments as slot roots; wrap multiple siblings in a single element.","Use custom prop when you need full control over the rendered element.","Test rendered DOM of custom links after refactors."],"tags":["vue-router","router-link","deprecation","migration","vue-router-4"],"backgroundTag":"router-link-tag-prop-removed","analyzedSha":"680ccc68c506cca9be6207745043245d61fa715a","analyzedAt":"2026-09-02T19:19:01.204Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}