术之多

  • 首页
  • Python
  • Java
  • IOS
  • Andorid
  • NodeJS
  • JavaScript
  • HTML5

$route.push 未定义

  • 2024-11-01

【Vue】【Router】手动跳转用 this.$router.push() 时 $router 未定义的问题

初入Vue,手写路由跳转时的问题: toXxxRoute: () => { this.$router.push({'path': '/xxx', 'name': 'xxx'}) } 由于使用了箭头函数,this的指向与传统 js 里不同 所以报错 TypeError: Cannot read property '$router' of undefined 与其保持一个this变量,不如改回写 function 的方式 toXxxRoute: function(){ this.$router.pu

热门专题

json转实体类 integer转字符串
springboot 自定义http状态码
切root 并 自动输入密码
oracle的round用法
语句cin>>x>>y表达什么
layui框架 返回的数据不符合规范
js扩展方法如何引用
top查找某一个进程
HTML5视频背景无法在iPhone上播放
conda 打包虚拟环境 解压
swoole 怎么清除队列
jsp方法怎么写调用两个controller
怎么在同一页添加多个图片
android 图标和文字在一起 自动换行
centos7 iptables 删除nat规则
periodictimer 等待2天
django ajax 导出excel
mfc,模式对话框风格
c# 获取程序启动路径
vue v-chart 双柱状图
Home

Powered By WordPress