vant官网网址Vant 4 – Lightweight Mobile UI Components built on Vue

一步安装vant

# 通过 npm 安装 npm i @vant/weapp -S —production

# 通过 yarn 安装 yarn add @vant/weappproduction

# 安装 0.x 版本 npm i vant-weapp -S —production

新建目录文件夹命名wxcomponents打开 node_modules/@vant/weapp 将 weapp里的dist文件复制到 wxcomponents文件里面 

 打开 App.vue引入

@import "/wxcomponents/dist/common/index.wxss";

打开 pages.json文件,复制下面这句话

"usingComponents": {
	"van-button": "wxcomponents/dist/button/index"
}

可以在 globalStyle里面全局注册,也可以用到pages路由注册

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注