首页 > 技术文章 > vue ts 监听路由改变

yixiaoyang- 2019-05-29 10:45 原文

@Watch('$route')
routechange(to: any, from: any) {
let routelink: string = to.path;
if (routelink === '/explorer') {



this['$router'].replace({path: '/electromagnetic'})//直接修改地址
this['$router'].replace({name: 'explorer'});//配置了路由

推荐阅读