Wechat applets are installed using the VantUI framework (Vant Weapp) yarn

1. Create a new project

WeChat developer tool version: 1.05.2204180
insert image description here
Choose not to use cloud services and not to use templates
insert image description here

2. Create package.json

Right click on the blank space and open it in an external terminal

Enter yarn initand press Enter (or npm init)

insert image description here

3. Install Vant (weapp)

yarn add @vant/weapp --production

insert image description here

4. Modify app.json

insert image description here
"style": "v2"Remove from app.json

5. Build NPM

tools-build npm
insert image description here

Note: The version used in the picture does not need to be changedproject.config.json

6. Get started

Add a button to

/pages/index/index.json

{
    
    
  "usingComponents": {
    
    
    "van-button": "@vant/weapp/button/index"
  }
}

/pages/index/index.wxml

<!--index.wxml-->
<view class="container">
  <van-button type="default">默认按钮</van-button>
<van-button type="primary">主要按钮</van-button>
<van-button type="info">信息按钮</van-button>
<van-button type="warning">警告按钮</van-button>
<van-button type="danger">危险按钮</van-button>
</view>

insert image description here

Guess you like

Origin blog.csdn.net/xuehu96/article/details/124307298