Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Vant development guide


May 07, 2021 Vant


Table of contents


Introduced

Thank you for using Vant.

Here's a guide to submitting feedback or code to Vant. Before submitting an issue or PR to Vant, take a few minutes to read the following text.

The Issue specification

  • When you encounter a problem, first verify that the problem is already documented in the issue or that it has been fixed
  • When you mention a problem, describe the problem you are experiencing in short language and add the environment and recovery steps for the problem that occurs

Participate in development

Local development

Follow these steps to develop the Vant component locally

# 克隆仓库
git clone [email protected]:youzan/vant.git

# 安装依赖
cd vant && npm run bootstrap

# 进入开发模式,浏览器访问 http://localhost:8080
npm run dev

The directory structure

  • The component code for the warehouse is under src, one folder per component
  • The docs directory is the code for the document site, which can be opened by running npm run dev in the directory when developed locally

The main directories of the project are as follows:

vant
├─ build     # 构建
├─ docs      # 文档
├─ src       # 组件
├─ packages  # 子包
├─ test      # 单测
└─ types     # 类型

Add a new component

When you add a new component, organize the files according to the directory structure below and configure the component name .js vant.config

src
└─ button
   ├─ demo             # 示例代码
   ├─ test             # 单元测试
   ├─ index.js         # 组件入口
   ├─ index.less       # 组件样式
   ├─ README.md        # 英文文档
   └─ README.zh-CN.md  # 中文文档

Submit a PR

Pull Request specification

  • If you're having trouble, it's recommended that you keep your PR small enough. Make sure that a PR solves only one problem or adds only one feature
  • When adding or modifying an existing component, remember to add or modify the test code to keep the code stable
  • Add the appropriate description in the PR and associate the relevant Issue

Pull Request process

  1. Fork master repository, if fork has passed, synchronize the latest code for the main repository
  2. A new branch is created based on the dev branch of the fork post-warehouse, such as button_color
  3. Develop on a new branch, and when the development is complete, mention pull Request to the dev branch of the main repository
  4. Pull Request is merged into the main repository after Review passes
  5. Wait for Vant to release, usually once a week

Sync the latest code

Before you mention Pull Request, follow the procedure below to synchronize the latest code for the main repository

# 添加主仓库到 remote,作为 fork 后仓库的上游仓库
git remote add upstream https://github.com/youzan/vant.git

# 拉取主仓库最新代码
git fetch upstream

# 切换至 dev 分支
git checkout dev

# 合并主仓库代码
git merge upstream/dev


Example demonstration