2021-09-30 16:58:13 +08:00

18 lines
995 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
* @Date: 2021-01-17 14:24:40
* @LastEditors: chentianshang
* @LastEditTime: 2021-01-17 19:42:53
* @FilePath: /github-h5-Dooring/doc/zh/guide/componentDev/dynamicLoading.md
-->
# 组件动态加载
目前H5-Dooring的组件都是通过动态加载的方式引入好处是我们在页面中只会加载我们需要的组件不需要的组件不会被加载这样可以提高页面加载的速度这样做也会出现一些问题比如一个长页面配置了很多组件那么一个页面加载过程可以会触发多次请求目前还没有遇到性能问题但后续会逐渐优化这个问题。
## umi3提供的dynamic
目前组件的动态加载我们采用的umi的dynamic方案基于它我们上层封装了一个组件动态加载器原理如下
<img src="../../../img/componentDev/dynamic.png" alt="foo">
具体代码可以参考Dooring的Github地址[https://github.com/MrXujiang/h5-Dooring](https://github.com/MrXujiang/h5-Dooring)