一、安装

npm i vant -S

 

二、引入

1.全局引入

import Vue from 'vue'
import Vant from 'vant'
import 'vant/lib/index.css'

Vue.use(Vant)

 

2.按需引入

// 1.需要先安装npm install babel-plugin-import -D
// 2.在babelrc中配置
   "plugins": [
    "transform-vue-jsx",
    "transform-runtime",
    ["import", [
      {
        "libraryName":"vant",
        "style":true
      }
      ]
    ]
  ]     

import { Button } from 'vant'

Vue.use(Button)