You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ant Design Vue 2.x supports all the modern browsers. If you want to use IE9+, you can use Ant Design Vue 1.x & Vue 2.x.
105
-
106
102
## Import on Demand
107
103
108
-
we can import individual components on demand:
109
-
110
-
```jsx
111
-
importButtonfrom'ant-design-vue/lib/button';
112
-
import'ant-design-vue/lib/button/style'; // or ant-design-vue/lib/button/style/css for css format file
113
-
```
114
-
115
-
We strongly recommend using [babel-plugin-import](https://github.com/ant-design/babel-plugin-import), which can convert the following code to the 'ant-design-vue/lib/xxx' way:
116
-
117
-
```jsx
118
-
import { Button } from'ant-design-vue';
119
-
```
120
-
121
-
And this plugin can load styles too, read [usage](https://github.com/ant-design/babel-plugin-import#usage) for more details.
122
-
123
-
> FYI, babel-plugin-import's `style` option will importing some global reset styles, don't use it if you don't need those styles. You can import styles manually via `import 'ant-design-vue/dist/antd.css'` and override the global reset styles.
124
-
125
-
If you use Vite, you can use [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components) to load on demand. However, this plugin can only deal with components. Others such as message should be loaded manually:
126
-
127
-
```ts
128
-
import { message } from'ant-design-vue';
129
-
import'ant-design-vue/es/message/style/css'; //use ant-design-vue/es instead of ant-design-vue/lib
130
-
```
104
+
`ant-design-vue` supports tree shaking of ES modules, so using `import { Button } from 'ant-design-vue';` would drop js code you didn't use.
Copy file name to clipboardExpand all lines: site/src/vueDocs/introduce.en-US.md
+9-51
Original file line number
Diff line number
Diff line change
@@ -49,11 +49,11 @@ You can subscribe to this feed for new version notifications: https://github.com
49
49
**We recommend using npm or yarn to install**,it not only makes development easier,but also allow you to take advantage of the rich ecosystem of Javascript packages and tooling.
50
50
51
51
```bash
52
-
$ npm install ant-design-vue --save
52
+
$ npm install ant-design-vue@4.x --save
53
53
```
54
54
55
55
```bash
56
-
$ yarn add ant-design-vue
56
+
$ yarn add ant-design-vue@4.x
57
57
```
58
58
59
59
If you are in a bad network environment,you can try other registries and tools like [cnpm](https://github.com/cnpm/cnpm).
@@ -62,11 +62,11 @@ If you are in a bad network environment,you can try other registries and tools
62
62
63
63
Add `script` and `link` tags in your browser and use the global variable `antd`.
64
64
65
-
We provide `antd.js``antd.css` and `antd.min.js``antd.min.css` under `ant-design-vue/dist` in antd's npm package. You can also download these files directly from [](https://www.jsdelivr.com/package/npm/ant-design-vue) or [unpkg](https://unpkg.com/ant-design-vue/dist/).
65
+
We provide `antd.js``antd.min.js`and `reset.css` under `ant-design-vue/dist` in antd's npm package. You can also download these files directly from [](https://www.jsdelivr.com/package/npm/ant-design-vue) or [unpkg](https://unpkg.com/ant-design-vue/dist/).
66
66
67
67
> **We strongly discourage loading the entire files** this will add bloat to your application and make it more difficult to receive bugfixes and updates. Antd is intended to be used in conjunction with a build tool, such as [webpack](https://webpack.github.io/), which will make it easy to import only the parts of antd that you are using.
68
68
69
-
> Note: you should import [dayjs](https://day.js.org/) and dayjs plugins before using antd.js.
69
+
> Note: you should import `vue`, [dayjs](https://day.js.org/) and dayjs plugins before using `antd.js`.
import'ant-design-vue/dist/antd.css';// or 'ant-design-vue/dist/antd.less'
94
+
import'ant-design-vue/dist/reset.css';
94
95
```
95
96
96
-
### Use modularized antd
97
+
### Use modularized ant-design-vue
97
98
98
-
- Use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (Recommended)
99
-
100
-
```jsx
101
-
// .babelrc or babel-loader option
102
-
{
103
-
"plugins": [
104
-
["import", { "libraryName":"ant-design-vue", "libraryDirectory":"es", "style":"css" }] // `style: true` for less
105
-
]
106
-
}
107
-
```
108
-
109
-
> Note: Don't set `libraryDirectory` if you are using webpack 1.
110
-
111
-
This allows you to import components from antd without having to manually import the corresponding stylesheet. The antd babel plugin will automatically import stylesheets.
112
-
113
-
```jsx
114
-
// import js and css modularly, parsed by babel-plugin-import
115
-
import { DatePicker } from'ant-design-vue';
116
-
```
117
-
118
-
- Manually import
119
-
120
-
```jsx
121
-
importDatePickerfrom'ant-design-vue/lib/date-picker'; // for js
122
-
import'ant-design-vue/lib/date-picker/style/css'; // for css
123
-
// import 'ant-design-vue/lib/date-picker/style'; // that will import less
`ant-design-vue` supports ES modules tree shaking by default.
142
100
143
101
## Links
144
102
@@ -154,7 +112,7 @@ import 'ant-design-vue/dist/antd.css'; // or 'ant-design-vue/dist/antd.less'
154
112
155
113
## Contributing
156
114
157
-
If you'd like to help us improve antd, just create a [Pull Request](https://github.com/vueComponent/ant-design-vue/pulls). Feel free to report bugs and issues [here](https://vuecomponent.github.io/issue-helper/).
115
+
If you'd like to help us improve ant-design-vue, just create a [Pull Request](https://github.com/vueComponent/ant-design-vue/pulls). Feel free to report bugs and issues [here](https://vuecomponent.github.io/issue-helper/).
158
116
159
117
> If you're new to posting issues, we ask that you read [_How To Ask Questions The Smart Way_](http://www.catb.org/~esr/faqs/smart-questions.html) and [How to Ask a Question in Open Source Community](https://github.com/seajs/seajs/issues/545) and [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) prior to posting. Well written bug reports help us help you!
0 commit comments