Preface: you may encounter a such a problem, in the monitoring page, whether there is (such as refresh, close and other operations), just encountered such a project on the problem!!
Problem: I encountered a situation where when I refresh the page by pressing f5 on the browser (PC), if the tarbbar at the bottom is custom, I will return to the default 1. The solution is as follows:
[vue – the router beforeRouteEnter documentation] (navigation guard | vue router (vuejs.org))
BeforeRouteEnter (to, from, next) {next(vm = >{vm.tabbarList.filter((item, index) = >{ if (item.path === to.fullPath) { vm.currentItem = index vm.currentPath = to.fullPath } }) }) },Copy the code