Open rainzee opened 12 months ago
当点击进入某篇文章后,使用浏览器的后退,回到博客主页,此时任何文章,都无法点击。
原因是,按下后退按钮后回到博客主页时自动执行的 rerender() 内,有如下判断
rerender()
https://github.com/xcatliu/pagic/blob/61c63447bbfa5190f02c6d9a364a13e83cfc24c5/src/plugins/script_index.js#L79-L82
该判断中,lastProps.layoutPath !== props.layoutPath 成立,只改变了地址栏的 URL 就触发 return 而 loading 没有被置为 false,在下一次点击链接触发 rerender() 时,下面的判断使得函数无法运行到后续跳转的部分
lastProps.layoutPath !== props.layoutPath
return
loading
false
https://github.com/xcatliu/pagic/blob/61c63447bbfa5190f02c6d9a364a13e83cfc24c5/src/plugins/script_index.js#L57-L59
当点击进入某篇文章后,使用浏览器的后退,回到博客主页,此时任何文章,都无法点击。