toOther(to,run) { if(this.$route.path!==`/${to}`){ location.hash = to; } },
解决办法:
在A中的click事件中将item传进toOther()函数中,再根据路由传入
toOther(to,run) { if(this.$route.path!==`/${to}`){ location.hash = to+'"text-align: center">
如图2,这样子我们便可以在 this.$route 的fullPath中拿到A中我们需要传递的参数了。
具体要拿还需要进行字符串的分割取出所需的信息,但是这样子会很繁琐,我们只需多加几个字,
在你的参数前加上'sth'=