vue路由 根据#后面的url显示对应的菜单

比如http://localhost:8080/#/1

那么菜单(路由)显示的是1下面的菜单

如果http://localhost:8080/#/2
那么菜单(路由)显示的是2下面的菜单

我直接修改路由不生效

image.png

阅读 2.3k
1 个回答

通过判断当前path,给菜单添加打开的class,
:class= "{'is-open' : $route.path === menuPath}"

推荐问题