Merge branch 'dev' into next

This commit is contained in:
chenjiahan
2022-01-17 19:48:33 +08:00
377 changed files with 5335 additions and 2565 deletions
@@ -16,6 +16,94 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details
### [v3.4.2](https://github.com/compare/v3.4.1...v3.4.2)
`2022-01-17`
**Feature**
- Cascader: add show-header prop [#10202](https://github.com/youzan/vant/issues/10202)
- Image: add position prop [#10142](https://github.com/youzan/vant/issues/10142)
- ImagePreview: improve zoom fluency [#10187](https://github.com/youzan/vant/issues/10187)
- Overlay: add lazy-render prop [#10180](https://github.com/youzan/vant/issues/10180)
- provide english version of web-types [#10207](https://github.com/youzan/vant/issues/10207)
**Bug Fixes**
- Calendar: incorrectly selected when a date is disabled [#10196](https://github.com/youzan/vant/issues/10196)
- Image: failed to hide loading when using lazy-load [#10193](https://github.com/youzan/vant/issues/10193)
- ImagePreview: incorrectly closed after zooming [#10188](https://github.com/youzan/vant/issues/10188)
- Skeleton: row prop can't be string type [#10172](https://github.com/youzan/vant/issues/10172)
- useHeight may get the wrong height [#10195](https://github.com/youzan/vant/issues/10195)
### [v3.4.1](https://github.com/compare/v3.4.0...v3.4.1)
`2022-01-10`
**Bug Fixes**
- Area: missing picker mask [#10164](https://github.com/youzan/vant/issues/10164)
- DatetimePicker: error in some edge cases [#10140](https://github.com/youzan/vant/issues/10140)
- Popover: fix gap under the triangle [#10148](https://github.com/youzan/vant/issues/10148)
### [v3.4.0](https://github.com/compare/v3.3.7...v3.4.0)
`2022-01-01`
**Bug Fixes**
- Icons: complete https protocol [#10079](https://github.com/youzan/vant/issues/10079)
- Picker: should not render mask and frame when options is empty [#10135](https://github.com/youzan/vant/issues/10135)
- Popup: close event emitted twice [#10132](https://github.com/youzan/vant/issues/10132)
- PullRefresh: may trigger browser bounce in some cases [#10080](https://github.com/youzan/vant/issues/10080)
- Step: fix inactive title style [#10049](https://github.com/youzan/vant/issues/10049)
- SwipeCell: should not trigger open event when opened [#10059](https://github.com/youzan/vant/issues/10059)
- swipe: delay load cause swipe error [#10052](https://github.com/youzan/vant/issues/10052) [#10069](https://github.com/youzan/vant/issues/10069)
- Tabs: should not render line when have no tab [#10063](https://github.com/youzan/vant/issues/10063)
**Feature**
- ActionBarIcon: add badge-props prop [#10096](https://github.com/youzan/vant/issues/10096)
- ActionSheet: add option slot [#10065](https://github.com/youzan/vant/issues/10065)
- Badge: add badge-props prop [#10095](https://github.com/youzan/vant/issues/10095)
- GridItem: add badge-props prop [#10097](https://github.com/youzan/vant/issues/10097)
- Icons: add cash-o icon [#10076](https://github.com/youzan/vant/issues/10076)
- ImagePreview: add overlayClass option [#10044](https://github.com/youzan/vant/issues/10044)
- Notify: add position prop [#10056](https://github.com/youzan/vant/issues/10056)
- Popover: add action slot [#10091](https://github.com/youzan/vant/issues/10091)
- Search: add click-left-icon、click-right-icon event [#10139](https://github.com/youzan/vant/issues/10139)
- SidebarItem: add badge-props prop [#10106](https://github.com/youzan/vant/issues/10106)
- Swipe: indicator slot add total param [#10060](https://github.com/youzan/vant/issues/10060)
- TabbarItem: add badge-props prop [#10092](https://github.com/youzan/vant/issues/10092)
- Tabs: add shrink prop [#10125](https://github.com/youzan/vant/issues/10125)
**style**
- PullRefresh: remove user-select: none [#10078](https://github.com/youzan/vant/issues/10078)
- TreeSelect: allow select text in content slot [#10081](https://github.com/youzan/vant/issues/10081)
**Types**
- define global components for volar [#10136](https://github.com/youzan/vant/issues/10136)
- Field: type prop allow all native types [#10042](https://github.com/youzan/vant/issues/10042)
- Popup: add PopupInstance type [#10062](https://github.com/youzan/vant/issues/10062)
- Search: fix missing event typing [#10134](https://github.com/youzan/vant/issues/10134)
### [v3.3.7](https://github.com/compare/v3.3.6...v3.3.7)
`2021-12-12`
**Feature**
- Badge: add position prop [#10024](https://github.com/youzan/vant/issues/10024)
**Bug Fixes**
- DatetimePicker: should update value after calling picker methods [#10029](https://github.com/youzan/vant/issues/10029)
- Field: fix the length of emoji [#10033](https://github.com/youzan/vant/issues/10033)
- Pagination: change event not work [#10018](https://github.com/youzan/vant/issues/10018)
- fix tree shaking is broken [#10034](https://github.com/youzan/vant/issues/10034)
### [v3.3.6](https://github.com/compare/v3.3.5...v3.3.6)
`2021-12-05`
+96 -7
View File
@@ -16,6 +16,95 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
## 更新内容
### [v3.4.2](https://github.com/compare/v3.4.1...v3.4.2)
`2022-01-17`
**Feature**
- Cascader: 新增 show-header 属性 [#10202](https://github.com/youzan/vant/issues/10202)
- Image: 新增 position 属性 [#10142](https://github.com/youzan/vant/issues/10142)
- ImagePreview: 优化缩放手势的流畅度 [#10187](https://github.com/youzan/vant/issues/10187)
- Overlay: 新增 lazy-render 属性 [#10180](https://github.com/youzan/vant/issues/10180)
- web-types.json 现在默认使用英文描述 [#10207](https://github.com/youzan/vant/issues/10207)
**Bug Fixes**
- Calendar: 修复范围选择包括被禁用的日期时可能选择错误的问题 [#10196](https://github.com/youzan/vant/issues/10196)
- Image: 修复使用 lazy-load 时可能无法正常加载的问题 [#10193](https://github.com/youzan/vant/issues/10193)
- ImagePreview: 修复快速缩放手势导致预览关闭的问题 [#10188](https://github.com/youzan/vant/issues/10188)
- Skeleton: 修复 row 属性为字符串类型时不生效的问题 [#10172](https://github.com/youzan/vant/issues/10172)
- NavBar: 修复在 safari 上占位元素高度错误的问题 [#10195](https://github.com/youzan/vant/issues/10195)
- Tabbar: 修复在 safari 上占位元素高度错误的问题 [#10195](https://github.com/youzan/vant/issues/10195)
### [v3.4.1](https://github.com/compare/v3.4.0...v3.4.1)
`2022-01-10`
**Bug Fixes**
- Area: 修复缺少遮罩层的问题 [#10164](https://github.com/youzan/vant/issues/10164)
- DatetimePicker: 修复边界场景下出现报错的问题 [#10140](https://github.com/youzan/vant/issues/10140)
- Popover: 修复箭头和弹出框之间存在缝隙的问题 [#10148](https://github.com/youzan/vant/issues/10148)
### [v3.4.0](https://github.com/compare/v3.3.7...v3.4.0)
`2022-01-01`
**Bug Fixes**
- Icons: 修复 URL 缺少协议导致个别浏览器出现异常的问题 [#10079](https://github.com/youzan/vant/issues/10079)
- Picker: 修复选项为空时也会渲染选择框的问题 [#10135](https://github.com/youzan/vant/issues/10135)
- Popup: 修复 close 事件触发两次的问题 [#10132](https://github.com/youzan/vant/issues/10132)
- PullRefresh: 修复在个别浏览器上会触发原生回弹效果的问题 [#10080](https://github.com/youzan/vant/issues/10080)
- Step: 修复 inactive-color 属性未正确生效的问题 [#10049](https://github.com/youzan/vant/issues/10049)
- SwipeCell: 修复打开状态下也会触发 open 事件的问题 [#10059](https://github.com/youzan/vant/issues/10059)
- swipe: 修复个别情况下无法正确滚动的问题 [#10052](https://github.com/youzan/vant/issues/10052) [#10069](https://github.com/youzan/vant/issues/10069)
- Tabs: 修复标签页为空时会渲染一个错误的底部条的问题 [#10063](https://github.com/youzan/vant/issues/10063)
**Feature**
- ActionBarIcon: 新增 badge-props 属性 [#10096](https://github.com/youzan/vant/issues/10096)
- ActionSheet: 新增 option 插槽 [#10065](https://github.com/youzan/vant/issues/10065)
- Badge: 新增 badge-props 属性 [#10095](https://github.com/youzan/vant/issues/10095)
- GridItem: 新增 badge-props 属性 [#10097](https://github.com/youzan/vant/issues/10097)
- Icons: 新增 cash-o 图标 [#10076](https://github.com/youzan/vant/issues/10076)
- ImagePreview: 新增 overlayClass 选项 [#10044](https://github.com/youzan/vant/issues/10044)
- Notify: 新增 position 属性 [#10056](https://github.com/youzan/vant/issues/10056)
- Popover: 新增 action 插槽 [#10091](https://github.com/youzan/vant/issues/10091)
- Search: 新增 click-left-icon、click-right-icon 事件 [#10139](https://github.com/youzan/vant/issues/10139)
- SidebarItem: 新增 badge-props 属性 [#10106](https://github.com/youzan/vant/issues/10106)
- Swipe: indicator 插槽新增 total 参数 [#10060](https://github.com/youzan/vant/issues/10060)
- TabbarItem: 新增 badge-props 属性 [#10092](https://github.com/youzan/vant/issues/10092)
- Tabs: 新增 shrink 属性 [#10125](https://github.com/youzan/vant/issues/10125)
**style**
- PullRefresh: 移除 `user-select: none` 样式 [#10078](https://github.com/youzan/vant/issues/10078)
- TreeSelect: 允许选中 content 插槽中的文字 [#10081](https://github.com/youzan/vant/issues/10081)
**Types**
- 增加所有组件的全局类型,在 volar 中提供默认提示 [#10136](https://github.com/youzan/vant/issues/10136)
- Field: 修复 type 属性定义不全的问题 [#10042](https://github.com/youzan/vant/issues/10042)
- Popup: 导出 PopupInstance 类型 [#10062](https://github.com/youzan/vant/issues/10062)
- Search: 修复事件类型定义不全的问题 [#10134](https://github.com/youzan/vant/issues/10134)
### [v3.3.7](https://github.com/compare/v3.3.6...v3.3.7)
`2021-12-12`
**Feature**
- Badge: 新增 position 属性 [#10024](https://github.com/youzan/vant/issues/10024)
**Bug Fixes**
- DatetimePicker: 修复调用 Picker 实例方法后日期未正确更新的问题 [#10029](https://github.com/youzan/vant/issues/10029)
- Field: 修复输入内容包含 emoji 时,长度计算错误的问题 [#10033](https://github.com/youzan/vant/issues/10033)
- Pagination: 修复 change 事件不触发的问题 [#10018](https://github.com/youzan/vant/issues/10018)
- 修复 tree shaking 不生效的问题 [#10034](https://github.com/youzan/vant/issues/10034)
### [v3.3.6](https://github.com/compare/v3.3.5...v3.3.6)
`2021-12-05`
@@ -59,15 +148,15 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
**Feature**
- 新增 `package.json` 中的 `exports` 字段 [#9952](https://github.com/issues/9952)
- Tabbar: 支持在 route 模式下匹配子路由 [#9926](https://github.com/issues/9926)
- Tabs: 将 `van-tab__pane-wrapper` 类重命名为 `van-tab__panel-wrapper` [#9951](https://github.com/issues/9951)
- 新增 `package.json` 中的 `exports` 字段 [#9952](https://github.com/youzan/vant/issues/9952)
- Tabbar: 支持在 route 模式下匹配子路由 [#9926](https://github.com/youzan/vant/issues/9926)
- Tabs: 将 `van-tab__pane-wrapper` 类重命名为 `van-tab__panel-wrapper` [#9951](https://github.com/youzan/vant/issues/9951)
**Bug Fixes**
- Calendar: 修复 show-confirm 为 false 时不会限制最大日期范围的问题 [#9948](https://github.com/issues/9948)
- Calendar: 修复 `scrollToDate` 方法无法精确滚动到对应日期的问题 [#9949](https://github.com/issues/9949)
- Swipe: 修复开始滑动时未阻止 touchmove 事件行为的问题 [#9920](https://github.com/issues/9920)
- Calendar: 修复 show-confirm 为 false 时不会限制最大日期范围的问题 [#9948](https://github.com/youzan/vant/issues/9948)
- Calendar: 修复 `scrollToDate` 方法无法精确滚动到对应日期的问题 [#9949](https://github.com/youzan/vant/issues/9949)
- Swipe: 修复开始滑动时未阻止 touchmove 事件行为的问题 [#9920](https://github.com/youzan/vant/issues/9920)
### [v3.3.1](https://github.com/compare/v3.3.0...v3.3.1)
@@ -75,7 +164,7 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
**Bug Fixes**
- AddressEdit: 修复表单校验不通过时也会触发 save 事件的问题 [#9917](https://github.com/issues/9917)
- AddressEdit: 修复表单校验不通过时也会触发 save 事件的问题 [#9917](https://github.com/youzan/vant/issues/9917)
### [v3.3.0](https://github.com/compare/v3.2.8...v3.3.0)
@@ -8,8 +8,8 @@
### Issue 规范
- 遇到问题时,请先确认这个问题是否已经在 issue 中有记录或者已被修复
- 提 issue 时,请用简短的语言描述遇到的问题,并添加出现问题时的环境和复现步骤
- 遇到问题时,请先确认这个问题是否已经在 issue 中有记录或者已被修复
- 提 issue 时,请用简短的语言描述遇到的问题,并添加出现问题时的环境和复现步骤
## 参与开发
@@ -71,28 +71,38 @@ src
└─ README.zh-CN.md # 中文文档
```
### 代码规范
在编写代码时,请注意:
- 确保代码可以通过仓库的 ESLint 和 Stylelint 校验。
- 确保代码格式是规范的,使用 prettier 进行代码格式化。
- 确保没有使用超出兼容性范围的 API,比如 `async/await`
## 提交 PR
### Pull Request 规范
### 参考指南
如果你是第一次在 GitHub 上提 Pull Request ,可以阅读下面这两篇文章来学习:
- [如何优雅地在 GitHub 上贡献代码](https://segmentfault.com/a/1190000000736629)
- [第一次参与开源](https://github.com/firstcontributions/first-contributions/blob/master/translations/README.chs.md)
#### 规范
### Pull Request 规范
- 如果遇到问题,建议保持你的 PR 足够小。保证一个 PR 只解决一个问题或只添加一个功能
- 当新增组件或者修改原有组件时,记得增加或者修改测试代码,保证代码的稳定
- 在 PR 中请添加合适的描述,并关联相关的 Issue
在提交 Pull Request 时,请注意:
- 如果遇到问题,建议保持你的 PR 足够小。保证一个 PR 只解决单个问题、添加单个功能。
- 当新增组件或者修改原有组件时,记得增加或者修改对应的单元测试,保证代码的稳定。
- 在 PR 中请添加合适的描述,并关联相关的 Issue。
### Pull Request 流程
1. fork 主仓库,如果已经 fork 过,请同步主仓库的最新代码
2. 基于 fork 后仓库的 dev 分支新建一个分支,比如 `feature/button_color`
3. 在新分支上进行开发,开发完成后,提 Pull Request 到主仓库的 dev 分支
4. Pull Request 会在 Review 通过后被合并到主仓库
5. 等待 Vant 发布版本,一般是每周一次
1. fork 主仓库,如果已经 fork 过,请同步主仓库的最新代码
2. 基于 fork 后仓库的 dev 分支新建一个分支,比如 `feature/button_color`
3. 在新分支上进行开发,开发完成后,提 Pull Request 到主仓库的 dev 分支
4. Pull Request 会在 Review 通过后被合并到主仓库
5. 等待 Vant 发布版本,一般是每周一次
### 同步最新代码
+1 -1
View File
@@ -48,7 +48,7 @@ Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3).
| Project | Description |
| --- | --- |
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | React mobile UI Components based on Vant |
| [mxdi9i7/vant-react](https://github.com/mxdi9i7/vant-react) | Mobile UI Components built on React and TS, inspired by Vant |
| [rc-ui-lib](https://github.com/rancui/rc-ui-lib) | React Mobile UI Components Library |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI |
+2 -2
View File
@@ -8,7 +8,7 @@
### 介绍
Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源,已持续维护 4 年时间。Vant 对内承载了有赞所有核心业务,对外服务十多万开发者,是业界主流的移动端组件库之一。
Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源。Vant 对内承载了有赞所有核心业务,对外服务十多万开发者,是业界主流的移动端组件库之一。
目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant)、[Vue 3 版本](https://vant-contrib.gitee.io/vant/v3)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/mxdi9i7/vant-react)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。
@@ -62,7 +62,7 @@ Vant 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致
| 项目 | 描述 |
| --- | --- |
| [3lang3/react-vant](https://github.com/3lang3/react-vant) | 参照 Vant 打造的 React 移动端组件库 |
| [mxdi9i7/vant-react](https://github.com/mxdi9i7/vant-react) | 基于 React 和 TS 构建的移动端组件库 |
| [rc-ui-lib](https://github.com/rancui/rc-ui-lib) | 基于 Vant 的 React 版本移动端 UI 组件库 |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Vant 支付宝小程序版 |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 |
| [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 |
@@ -99,7 +99,14 @@ If you are using vite, please use [vite-plugin-style-import](https://github.com/
#### 1. Install Plugin
```bash
npm i vite-plugin-style-import@1.2.0 -D
# with npm
npm i vite-plugin-style-import -D
# with yarn
yarn add vite-plugin-style-import -D
# with pnpm
pnpm add vite-plugin-style-import -D
```
#### 2. Configure Plugin
@@ -108,19 +115,13 @@ Configure the plugin in the `vite.config.js` file:
```js
import vue from '@vitejs/plugin-vue';
import styleImport from 'vite-plugin-style-import';
import styleImport, { VantResolve } from 'vite-plugin-style-import';
export default {
plugins: [
vue(),
styleImport({
libs: [
{
libraryName: 'vant',
esModule: true,
resolveStyle: (name) => `vant/es/${name}/style/index`,
},
],
resolves: [VantResolve()],
}),
],
};
@@ -100,7 +100,14 @@ pnpm add vant@3
#### 1. 安装插件
```bash
npm i vite-plugin-style-import@1.2.0 -D
# 通过 npm 安装
npm i vite-plugin-style-import -D
# 通过 yarn 安装
yarn add vite-plugin-style-import -D
# 通过 pnpm 安装
pnpm add vite-plugin-style-import -D
```
#### 2. 配置插件
@@ -109,19 +116,13 @@ npm i vite-plugin-style-import@1.2.0 -D
```js
import vue from '@vitejs/plugin-vue';
import styleImport from 'vite-plugin-style-import';
import styleImport, { VantResolve } from 'vite-plugin-style-import';
export default {
plugins: [
vue(),
styleImport({
libs: [
{
libraryName: 'vant',
esModule: true,
resolveStyle: (name) => `vant/es/${name}/style/index`,
},
],
resolves: [VantResolve()],
}),
],
};
@@ -4,6 +4,21 @@
Vant provide some built-in composition APIs, you can directly use these APIs for development.
### Install
Although `@vant/use` is already included in Vant's dependencies, it is still recommended to install this package explicitly:
```shell
# with npm
npm i @vant/use
# with yarn
yarn add @vant/use
# with pnpm
pnpm add @vant/use
```
### Demo
```js
@@ -2,7 +2,22 @@
### 介绍
Vant 内置了一系列的组合式 API对于安装了 `vant` 的项目,可以直接使用这些 API 进行开发。
Vant 底层依赖了 `@vant/use` 包,其中内置了一系列的组合式 API对于使用了 Vant 的项目,可以用这些 API 进行开发。
### 安装
虽然 Vant 的依赖中已经包含了 `@vant/use`,但我们仍然推荐显式地安装它:
```shell
# with npm
npm i @vant/use
# with yarn
yarn add @vant/use
# with pnpm
pnpm add @vant/use
```
### 示例