armycm 2023-09-06 17:07 采纳率: 0%
浏览 4

vue-router的key属性值

设置 router-view 的 key 属性值为 $route.fullPath时,报错Property or method "key" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-09-06 20:37
    关注

    【相关推荐】



    • 看下这篇博客,也许你就懂了,链接:关于Vue中给router-view 设置key的原因($route-fullPath)
    • 除此之外, 这篇博客: vue中 给router-view 组件的 绑定 key 的原因中的 3. 设置 router-view 的 key 属性值为 $route.fullPath 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:

      从/page/1 => /page/2, 由于这两个路由的$route.fullPath并不一样, 所以组件被强制不复用, 相关钩子加载顺序为:
      beforeRouteUpdate => created => mounted

      从/page?id=1 => /page?id=2, 由于这两个路由的$route.fullPath并不一样, 所以组件被强制不复用, 相关钩子加载顺序为:
      beforeRouteUpdate => created => mounted


    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

问题事件

  • 创建了问题 9月6日

悬赏问题

  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Bug traq 数据包 大概什么价
  • ¥15 在anaconda上pytorch和paddle paddle下载报错
  • ¥25 自动填写QQ腾讯文档收集表