摘要: //history.pushState附加哈希值并不会触发onhashchange var newHash = 'test'; history.replaceState(null, null, window.location.pathname + '#' + newHash); Hash模式底层思想 阅读全文
posted @ 2021-03-27 05:15 coffeemil 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 路由懒加载 当打包构建应用时,JavaScript 包会变得非常大,影响页面加载。如果我们能把不同路由对应的组件分割成不同的代码块,然后当路由被访问的时候才加载对应组件,这样就更加高效了。 如何定义一个能够被 Webpack 自动代码分割的异步组件? const Foo = () => import 阅读全文
posted @ 2021-03-27 03:26 coffeemil 阅读(64) 评论(0) 推荐(0) 编辑