小程序引入Vant Weapp

npm i @vant/weapp -S --production

步骤二 修改 app.json

将 app.json 中的 "style": "v2" 去除,小程序的新版基础组件强行加上了许多样式,难以覆盖,不关闭将造成部分组件样式混乱。

app.json

  "usingComponents": {
    "van-button": "miniprogram/miniprogram_npm/@vant/weapp/button/index",
    "van-image":"miniprogram/miniprogram_npm/@vant/weapp/image/index",
    "van-grid":"miniprogram/miniprogram_npm/@vant/weapp/grid/index",
    "van-grid-item":"miniprogram/miniprogram_npm/@vant/weapp/grid-item/index",
    "van-cell": "miniprogram/miniprogram_npm/@vant/weapp/cell/index",
    "van-cell-group": "miniprogram/miniprogram_npm/@vant/weapp/cell-group/index",
    "van-field": "miniprogram/miniprogram_npm/@vant/weapp/field/index",
    "van-submit-bar": "miniprogram/miniprogram_npm/@vant/weapp/submit-bar/index",
    "van-tab": "miniprogram/miniprogram_npm/@vant/weapp/tab/index",
    "van-tabs": "miniprogram/miniprogram_npm/@vant/weapp/tabs/index",
"van-dialog": "miniprogram/miniprogram_npm/@vant/weapp/dialog/index"



  }

project.config.json

{
  ...
  "setting": {
    ...
    "packNpmManually": true,
    "packNpmRelationList": [
      {
        "packageJsonPath": "./package.json",
        "miniprogramNpmDistDir": "./miniprogram/"
      }
    ]
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值