[Doc] ts import plugin (#1230)

This commit is contained in:
neverland 2018-06-06 19:23:30 +08:00 committed by GitHub
parent 333dedc22c
commit b16342ef00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -81,6 +81,8 @@ Then you can import components from vant, equivalent to import manually below.
import { Button } from 'vant';
```
> If you are using TypeScriptplease use [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) instead
#### 2. Manually import
```js

View File

@ -82,6 +82,8 @@ npm i babel-plugin-import -D
import { Button } from 'vant';
```
> 如果你在使用 TypeScript可以使用 [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) 实现按需引入
#### 方式二. 按需引入组件
在不使用插件的情况下,可以手动引入需要的组件

View File

@ -62,6 +62,8 @@ Then you can import components from vant, equivalent to import manually below.
import { Button } from 'vant';
```
> If you are using TypeScriptplease use [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) instead
#### 2. Manually import
```js

View File

@ -66,6 +66,8 @@ npm i babel-plugin-import -D
import { Button, Cell } from 'vant';
```
> 如果你在使用 TypeScript可以使用 [ts-import-plugin](https://github.com/Brooooooklyn/ts-import-plugin) 实现按需引入
#### 方式二. 按需引入组件
在不使用插件的情况下,可以手动引入需要的组件
@ -86,7 +88,7 @@ import 'vant/lib/vant-css/index.css';
Vue.use(Vant);
```
>注意:配置 babel-plugin-import 插件后将不允许导入所有组件
> 注意:配置 babel-plugin-import 插件后将不允许导入所有组件
### Rem 适配