vue框架,在当前页面下,进行F5刷新后,跳转到指定的另一个页面,应该怎么做。
2条回答 默认 最新
- tonyzhangcn 2021-11-02 10:03关注
在你的vue项目app.vue的script 标签中加入下面的代码。 <script> document.onkeydown=(event)=>{ if(event.keyCode===116){ event.preventDefault(); console.log('f5'); window.location="http://www.sina.com.cn"; //这里http://www.sina.com.cn 你可以替换成自己要跳转的url } } </script>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报