readme
Showing
1 changed file
with
20 additions
and
13 deletions
| ... | @@ -222,24 +222,31 @@ module.exports = { | ... | @@ -222,24 +222,31 @@ module.exports = { |
| 222 | 222 | ||
| 223 | #### 安装插件 | 223 | #### 安装插件 |
| 224 | 224 | ||
| 225 | ```javascript | 225 | ```bash |
| 226 | npm i babel-plugin-import -D | 226 | npm i babel-plugin-import -D |
| 227 | ``` | ||
| 228 | |||
| 229 | 在` babel.config.js` 设置 | ||
| 230 | |||
| 231 | ```javascript | ||
| 227 | 232 | ||
| 228 | // 对于使用 babel7 的用户,可以在 babel.config.js 中配置 | 233 | // 对于使用 babel7 的用户,可以在 babel.config.js 中配置 |
| 229 | module.exports = { | 234 | const plugins = [ |
| 230 | presets: [['@vue/cli-plugin-babel/preset', {useBuiltIns: 'entry'}]], | 235 | [ |
| 231 | plugins: [ | 236 | 'import', |
| 232 | [ | 237 | { |
| 233 | 'import', | 238 | libraryName: 'vant', |
| 234 | { | 239 | libraryDirectory: 'es', |
| 235 | libraryName: 'vant', | 240 | style: true |
| 236 | libraryDirectory: 'es', | 241 | }, |
| 237 | style: true | 242 | 'vant' |
| 238 | }, | ||
| 239 | 'vant' | ||
| 240 | ] | ||
| 241 | ] | 243 | ] |
| 244 | ] | ||
| 245 | module.exports = { | ||
| 246 | presets: [['@vue/cli-plugin-babel/preset', {useBuiltIns: 'usage', corejs: 3}]], | ||
| 247 | plugins | ||
| 242 | } | 248 | } |
| 249 | |||
| 243 | ``` | 250 | ``` |
| 244 | 251 | ||
| 245 | #### 使用组件 | 252 | #### 使用组件 | ... | ... |
-
Please register or sign in to post a comment