mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
update introduce.md
This commit is contained in:
parent
a8808c45ac
commit
c5ab604f70
@ -161,11 +161,15 @@ There are some [scaffolds](https://github.com/ant-design/ant-design/issues/129)
|
||||
|
||||
## Import on Demand
|
||||
|
||||
If you see a log like below screenshot, you might import all components by writing `import { Button } from 'antd';`, this will affect your app's network perfermance.
|
||||
If you see logs like below screenshot, you might import all components by writing `import { Button } from 'antd';`, this will affect your app's network perfermance.
|
||||
|
||||
> ![](https://zos.alipayobjects.com/rmsportal/vgcHJRVZFmPjAawwVoXK.png)
|
||||
```
|
||||
You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.
|
||||
```
|
||||
|
||||
But, we can import individual components on demand:
|
||||
> ![](https://zos.alipayobjects.com/rmsportal/GHIRszVcmjccgZRakJDQ.png)
|
||||
|
||||
However, we can import individual components on demand:
|
||||
|
||||
```jsx
|
||||
import Button from 'antd/lib/button';
|
||||
|
@ -159,9 +159,13 @@ IE8 需要配合使用 [react@0.14.x](https://facebook.github.io/react/blog/2016
|
||||
|
||||
## 按需加载
|
||||
|
||||
如果你在控制台看到下面的提示,则你可能使用了 `import { Button } from 'antd';` 的写法引入了 antd 下所有的模块,这会影响应用的网络性能。
|
||||
如果你在开发环境的控制台看到下面的提示,那么你可能使用了 `import { Button } from 'antd';` 的写法引入了 antd 下所有的模块,这会影响应用的网络性能。
|
||||
|
||||
> ![](https://zos.alipayobjects.com/rmsportal/vgcHJRVZFmPjAawwVoXK.png)
|
||||
```
|
||||
You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.
|
||||
```
|
||||
|
||||
> ![](https://zos.alipayobjects.com/rmsportal/GHIRszVcmjccgZRakJDQ.png)
|
||||
|
||||
可以通过以下的写法来按需加载组件。
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user