6-1安装依赖

  1. yarn add vant babel-plugin-import

6-2配置babel.config.js

  1. {
  2. "plugins": [
  3. ["import", {
  4. "libraryName": "vant",
  5. "libraryDirectory": "es",
  6. "style": true
  7. }]
  8. ]
  9. }

6-3在main.js中按需引入需要的组件

  1. import { Button } from 'vant';
  2. Vue.use(Button)

6-4使用

  1. <van-button type="default">默认按钮</van-button>

官网https://youzan.github.io/vant/?source=vuejsorg#/zh-CN/quickstart

4-8//课件地址 notebooks/vue-turtorial/day07