在新项目中使用 Vant 时,推荐使用 Vue 官方提供的脚手架 Vue Cli 创建项目并安装 Vant。
1.安装 Vue Cli
npm install -g @vue/cli
2.创建一个项目
vue create hello-world
3.安装 Vant 2
npm i vant -S
main.js 加入下面代码
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.use(Vant)
4.增加路由模块
vue add router