typescript - vue-router 3.5.1 : <router-link>'s tag prop is deprecated and has been removed in Vue Router 4 中的警告

标签 typescript vue.js vuejs2 vue-router vue-router4

自从我更新了 Vue.js 应用程序的节点包后,我在浏览器控制台中收到以下警告:

[vue-router] '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. @ vue-router.esm.js:16

当然,信息非常简单明了,但是:

在一个地方,<router-link>正在使用中,已弃用 tag Prop 甚至没有应用:

<router-link
    class="button-add"
    :to="{
        name: 'ItemEditorAdd',
        params: { parent_item_id: item.id },
    }"
    :id="'button-' + item.id"
>
    <i class="material-icons">add</i>
</router-link>

此外,安装的vue-router包甚至不是​​4版本的,而是3版本的,与v2.6安装的vue.js正确匹配。警告消息给我的印象是,兼容性检查器假设正在使用 v4。

摘自 package.json:

"vue": "^2.6.12",
"vue-class-component": "^7.2.6",
"vue-cookies-ts": "^1.5.19",
"vue-i18n": "^8.24.4",
"vue-property-decorator": "^9.1.2",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
"vuex-class": "^0.3.2",
"vuex-oidc": "^3.10.2"

我很困惑,我在 StackOverflow 中找不到解决方案或在 vue-router Github issues .
这个警告是不可修复的,而只是在将来某个时候升级时不断提醒您注意这一点?如果是这样,为什么不检查 tag prop 确实被使用了 - 似乎有点垃圾..

更新
vue-router v3.5.2 也有这个问题。
有一个 GitHub vue-router issue (关闭)和一个 Github boostrap-vue issue (打开)。

最佳答案

在这个 GitHub boostrap-vue issues comment 中找到了答案通过 caugner:

The issue was fixed by #6374 and will appear in the next minor version (2.22.0).
That PR resolves the warnings for most users, except those that actually use the event and tag props on BLink and similar components.

bootstrap-vue 2.22.0 尚未发布。当前最新版本是 2021 年 1 月的 v2.21.2。

据我所知,在甚至不使用 eventtag 属性的情况下,目前还没有针对此警告的解决方案。

关于typescript - vue-router 3.5.1 : <router-link>'s tag prop is deprecated and has been removed in Vue Router 4 中的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67531261/

相关文章:

javascript - 如何在 vue.js 中包含第 3 方 JavaScript 文件?

javascript - NuxtJs vue-flip 不在正面和背面之间翻转

javascript - 显示 "hours and minutes"适用于除 safari 之外的所有浏览器。 JavaScript 日期

javascript - Prerender vue.js 2.0组件(类似于vue 1中的this.$compile)

JavaScript 将数据分组到 TreeView 中,深度为 2 层,最后一层为数组

reactjs - react-spring interpolate 函数不适用于 typescript

typescript - 未捕获的 TypeError : THREE. MTLLoader 不是构造函数 2.0

javascript - 如何在 ngFor 中使用引用 id ( # ) 并在下一个 NG select 中获得焦点?

vue.js - 尝试从 vuejs 组件分派(dispatch)操作时,vuex 未知操作类型

javascript - Vue.js : How to use a computed property to modify string and apply dynamically as CSS class