From 54af29050f055303215b35542950df907b563df7 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 17 Feb 2022 18:06:59 +0800 Subject: [PATCH 01/24] docs: update vite-plugin-style-import version (#10303) --- packages/vant/docs/markdown/quickstart.en-US.md | 6 +++--- packages/vant/docs/markdown/quickstart.zh-CN.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/vant/docs/markdown/quickstart.en-US.md b/packages/vant/docs/markdown/quickstart.en-US.md index 409704c3f..85e21413d 100644 --- a/packages/vant/docs/markdown/quickstart.en-US.md +++ b/packages/vant/docs/markdown/quickstart.en-US.md @@ -100,13 +100,13 @@ If you are using vite, please use [vite-plugin-style-import](https://github.com/ ```bash # with npm -npm i vite-plugin-style-import -D +npm i vite-plugin-style-import@1.4.1 -D # with yarn -yarn add vite-plugin-style-import -D +yarn add vite-plugin-style-import@1.4.1 -D # with pnpm -pnpm add vite-plugin-style-import -D +pnpm add vite-plugin-style-import@1.4.1 -D ``` #### 2. Configure Plugin diff --git a/packages/vant/docs/markdown/quickstart.zh-CN.md b/packages/vant/docs/markdown/quickstart.zh-CN.md index 72939bd54..e3853227b 100644 --- a/packages/vant/docs/markdown/quickstart.zh-CN.md +++ b/packages/vant/docs/markdown/quickstart.zh-CN.md @@ -101,13 +101,13 @@ pnpm add vant ```bash # 通过 npm 安装 -npm i vite-plugin-style-import -D +npm i vite-plugin-style-import@1.4.1 -D # 通过 yarn 安装 -yarn add vite-plugin-style-import -D +yarn add vite-plugin-style-import@1.4.1 -D # 通过 pnpm 安装 -pnpm add vite-plugin-style-import -D +pnpm add vite-plugin-style-import@1.4.1 -D ``` #### 2. 配置插件 From cbe16a372474ef0ddd7f5728c7506210b2878937 Mon Sep 17 00:00:00 2001 From: 3lang <675483520@qq.com> Date: Fri, 18 Feb 2022 11:22:17 +0800 Subject: [PATCH 02/24] docs: update react-vant address (#10305) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: update react-vant address [vant-react](https://github.com/mxdi9i7/vant-react) 已经停止维护很久啦, 让我来顶一下👶 * docs: update react-vant address --- README.zh-CN.md | 2 +- packages/vant/docs/markdown/home.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index ab1fb5998..f233139b7 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -27,7 +27,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源。Vant 对内承载了有赞所有核心业务,对外服务十多万开发者,是业界主流的移动端组件库之一。 -目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/mxdi9i7/vant-react)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。 +目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。 ## 特性 diff --git a/packages/vant/docs/markdown/home.zh-CN.md b/packages/vant/docs/markdown/home.zh-CN.md index 5225a0a4f..9a89cdae4 100644 --- a/packages/vant/docs/markdown/home.zh-CN.md +++ b/packages/vant/docs/markdown/home.zh-CN.md @@ -10,7 +10,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源。Vant 对内承载了有赞所有核心业务,对外服务十多万开发者,是业界主流的移动端组件库之一。 -目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/mxdi9i7/vant-react)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。 +目前 Vant 官方提供了 [Vue 2 版本](https://vant-contrib.gitee.io/vant/v2)、[Vue 3 版本](https://vant-contrib.gitee.io/vant)和[微信小程序版本](http://vant-contrib.gitee.io/vant-weapp),并由社区团队维护 [React 版本](https://github.com/3lang3/react-vant)和[支付宝小程序版本](https://github.com/ant-move/Vant-Aliapp)。 ### 版本提示 From f2c4590902c5be73325fd61219cc9dc815846558 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 21 Feb 2022 11:51:23 +0800 Subject: [PATCH 03/24] fix(Toast): failed to render message after changing type (#10311) --- packages/vant/src/toast/Toast.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant/src/toast/Toast.tsx b/packages/vant/src/toast/Toast.tsx index 58b3c2dbc..89213854f 100644 --- a/packages/vant/src/toast/Toast.tsx +++ b/packages/vant/src/toast/Toast.tsx @@ -120,7 +120,7 @@ export default defineComponent({ if (isDef(message) && message !== '') { return type === 'html' ? ( -
+
) : (
{message}
); From 2d67eb6650fae8122ce1e73ec3a2c38a4e443eed Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 22 Feb 2022 14:25:12 +0800 Subject: [PATCH 04/24] Update contribution.zh-CN.md (#10314) --- packages/vant/docs/markdown/contribution.zh-CN.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vant/docs/markdown/contribution.zh-CN.md b/packages/vant/docs/markdown/contribution.zh-CN.md index 1c38e9c80..1f95063a1 100644 --- a/packages/vant/docs/markdown/contribution.zh-CN.md +++ b/packages/vant/docs/markdown/contribution.zh-CN.md @@ -21,8 +21,6 @@ ```bash # 克隆仓库 -# 默认为 dev 分支,对应 Vant 3 的代码 -# 如果需要在 Vant 2 上进行更改,请基于 2.x 分支进行开发 git clone git@github.com:youzan/vant.git # 安装依赖 @@ -32,6 +30,12 @@ pnpm i pnpm dev ``` +仓库的不同分支对应不同的 Vant 版本,请切换到对应分支进行开发: + +- 2.x 分支对应 Vant 2 版本,适用于 Vue 2 +- dev 分支对应 Vant 3 版本 ,适用于 Vue 3 +- next 分支对应 Vant 4 版本,适用于 Vue 3 + ### 目录结构 Vant 采用 monorepo 进行代码管理,所有子包在 `packages` 目录下: From 096a6f65b3f35661d6260fb5ad814f804d3f1a17 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Wed, 23 Feb 2022 23:09:05 +0800 Subject: [PATCH 05/24] fix(SwipeCell): cell should stopPropagation when lockClick is true (#10319) --- packages/vant/src/swipe-cell/SwipeCell.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant/src/swipe-cell/SwipeCell.tsx b/packages/vant/src/swipe-cell/SwipeCell.tsx index 668b10776..d00987a6a 100644 --- a/packages/vant/src/swipe-cell/SwipeCell.tsx +++ b/packages/vant/src/swipe-cell/SwipeCell.tsx @@ -219,7 +219,7 @@ export default defineComponent({
Date: Fri, 25 Feb 2022 10:03:16 +0800 Subject: [PATCH 06/24] docs(changelog): fix link mistake (#10328) --- .../vant/docs/markdown/changelog.en-US.md | 22 +++++++++---------- .../vant/docs/markdown/changelog.zh-CN.md | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/vant/docs/markdown/changelog.en-US.md b/packages/vant/docs/markdown/changelog.en-US.md index 93ca309b2..7a121a32a 100644 --- a/packages/vant/docs/markdown/changelog.en-US.md +++ b/packages/vant/docs/markdown/changelog.en-US.md @@ -22,23 +22,23 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/). **Feature** -- CollapseItem: add lazy-render prop [#10270](https://github.com/issues/10270) -- Dialog: support enter/esc keyboard event [#10261](https://github.com/issues/10261) -- Locale: add Bangla (Bangladesh) [#10287](https://github.com/issues/10287) -- Locale: add Indonesian translation [#10289](https://github.com/issues/10289) -- Locale: add Italian translation [#10288](https://github.com/issues/10288) -- Locale: add Ukrainian translation [#10291](https://github.com/issues/10291) -- Locale: add Vietnamese translation [#10294](https://github.com/issues/10294) +- CollapseItem: add lazy-render prop [#10270](https://github.com/youzan/vant/issues/10270) +- Dialog: support enter/esc keyboard event [#10261](https://github.com/youzan/vant/issues/10261) +- Locale: add Bangla (Bangladesh) [#10287](https://github.com/youzan/vant/issues/10287) +- Locale: add Indonesian translation [#10289](https://github.com/youzan/vant/issues/10289) +- Locale: add Italian translation [#10288](https://github.com/youzan/vant/issues/10288) +- Locale: add Ukrainian translation [#10291](https://github.com/youzan/vant/issues/10291) +- Locale: add Vietnamese translation [#10294](https://github.com/youzan/vant/issues/10294) **style** -- SubmitBar: using english colon [#10286](https://github.com/issues/10286) +- SubmitBar: using english colon [#10286](https://github.com/youzan/vant/issues/10286) **Types** -- IndexBar: index-list prop can includes number [#10273](https://github.com/issues/10273) -- Toast: fix missing teleport prop [#10272](https://github.com/issues/10272) -- Uploader: fix UploaderBeforeRead type [#10274](https://github.com/issues/10274) +- IndexBar: index-list prop can includes number [#10273](https://github.com/youzan/vant/issues/10273) +- Toast: fix missing teleport prop [#10272](https://github.com/youzan/vant/issues/10272) +- Uploader: fix UploaderBeforeRead type [#10274](https://github.com/youzan/vant/issues/10274) ### [v3.4.4](https://github.com/youzan/vant/compare/v3.4.4...v3.4.3) diff --git a/packages/vant/docs/markdown/changelog.zh-CN.md b/packages/vant/docs/markdown/changelog.zh-CN.md index 117ed7b36..d53b8b96a 100644 --- a/packages/vant/docs/markdown/changelog.zh-CN.md +++ b/packages/vant/docs/markdown/changelog.zh-CN.md @@ -22,23 +22,23 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。 **Feature** -- CollapseItem: 新增 lazy-render 属性 [#10270](https://github.com/issues/10270) -- Dialog: 支持通过 enter/esc 进行键盘操作 [#10261](https://github.com/issues/10261) -- Locale: 新增 Bangla 孟加拉语 [#10287](https://github.com/issues/10287) -- Locale: 新增 Indonesian 印度尼西亚语 [#10289](https://github.com/issues/10289) -- Locale: 新增 Italian 意大利语 [#10288](https://github.com/issues/10288) -- Locale: 新增 Ukrainian 乌克兰语 [#10291](https://github.com/issues/10291) -- Locale: 新增 Vietnamese 越南语 [#10294](https://github.com/issues/10294) +- CollapseItem: 新增 lazy-render 属性 [#10270](https://github.com/youzan/vant/issues/10270) +- Dialog: 支持通过 enter/esc 进行键盘操作 [#10261](https://github.com/youzan/vant/issues/10261) +- Locale: 新增 Bangla 孟加拉语 [#10287](https://github.com/youzan/vant/issues/10287) +- Locale: 新增 Indonesian 印度尼西亚语 [#10289](https://github.com/youzan/vant/issues/10289) +- Locale: 新增 Italian 意大利语 [#10288](https://github.com/youzan/vant/issues/10288) +- Locale: 新增 Ukrainian 乌克兰语 [#10291](https://github.com/youzan/vant/issues/10291) +- Locale: 新增 Vietnamese 越南语 [#10294](https://github.com/youzan/vant/issues/10294) **style** -- SubmitBar: 将冒号调整为英文冒号 [#10286](https://github.com/issues/10286) +- SubmitBar: 将冒号调整为英文冒号 [#10286](https://github.com/youzan/vant/issues/10286) **Types** -- IndexBar: 修复 index-list 属性无法传入 number 类型的问题 [#10273](https://github.com/issues/10273) -- Toast: 修复缺少 teleport 属性定义的问题 [#10272](https://github.com/issues/10272) -- Uploader: 修复 UploaderBeforeRead 类型定义不准确的问题 [#10274](https://github.com/issues/10274) +- IndexBar: 修复 index-list 属性无法传入 number 类型的问题 [#10273](https://github.com/youzan/vant/issues/10273) +- Toast: 修复缺少 teleport 属性定义的问题 [#10272](https://github.com/youzan/vant/issues/10272) +- Uploader: 修复 UploaderBeforeRead 类型定义不准确的问题 [#10274](https://github.com/youzan/vant/issues/10274) ### [v3.4.4](https://github.com/youzan/vant/compare/v3.4.4...v3.4.3) From 15a77eec13c8b53f262c7a14091ed90a6b397ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E5=8D=9A?= Date: Fri, 25 Feb 2022 14:08:44 +0800 Subject: [PATCH 07/24] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AE=98=E7=BD=91=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97=E7=9A=84?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E9=93=BE=E6=8E=A5=E5=8F=8A=20issue=20?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#10329)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: cklwblove --- .../vant-cli/template/changelog-commit.hbs | 28 +++++++++++++++++-- .../vant-cli/template/changelog-header.hbs | 14 +++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/packages/vant-cli/template/changelog-commit.hbs b/packages/vant-cli/template/changelog-commit.hbs index a05524abc..4b567e537 100644 --- a/packages/vant-cli/template/changelog-commit.hbs +++ b/packages/vant-cli/template/changelog-commit.hbs @@ -5,7 +5,31 @@ {{~header}} {{~/if}} {{#if references~}} - {{~#each references}} [{{~this.repository}}#{{this.issue}}]({{~@root.repoUrl}}/{{~@root.issue}}/{{this.issue}}){{/each}} -{{~else}} [{{shortHash}}]({{~@root.repoUrl}}/{{~@root.commit}}/{{hash}}) + {{~#each references}} [{{~this.repository}}#{{this.issue}}]( + {{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} + {{~else}} + {{~@root.repoUrl}} + {{~/if}} + /{{~@root.issue}}/{{this.issue}}){{/each}} +{{~else}} [{{shortHash}}]( +{{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} +{{~else}} + {{~@root.repoUrl}} +{{~/if}} +/{{~@root.commit}}/{{hash}}) {{~/if}} diff --git a/packages/vant-cli/template/changelog-header.hbs b/packages/vant-cli/template/changelog-header.hbs index bd0a517f9..aa5de66c0 100644 --- a/packages/vant-cli/template/changelog-header.hbs +++ b/packages/vant-cli/template/changelog-header.hbs @@ -1,3 +1,15 @@ -### [v{{version}}]({{~@root.repoUrl}}/compare/{{previousTag}}...{{currentTag}}) +### [v{{version}}]( +{{~#if @root.repository}} + {{~#if @root.host}} + {{~@root.host}}/ + {{~/if}} + {{~#if @root.owner}} + {{~@root.owner}}/ + {{~/if}} + {{~@root.repository}} +{{~else}} + {{~@root.repoUrl}} +{{~/if}} +/compare/{{previousTag}}...{{currentTag}}) `{{date}}` From 760f956f918ef6d9fcae5ceea2a334a0e3539434 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 27 Feb 2022 12:34:36 +0800 Subject: [PATCH 08/24] fix(cli): issue link in generated changelog (#10337) --- packages/vant-cli/template/changelog-commit.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant-cli/template/changelog-commit.hbs b/packages/vant-cli/template/changelog-commit.hbs index 4b567e537..82b43a9fc 100644 --- a/packages/vant-cli/template/changelog-commit.hbs +++ b/packages/vant-cli/template/changelog-commit.hbs @@ -17,7 +17,7 @@ {{~else}} {{~@root.repoUrl}} {{~/if}} - /{{~@root.issue}}/{{this.issue}}){{/each}} +/{{~@root.issue}}/{{this.issue}}){{/each}} {{~else}} [{{shortHash}}]( {{~#if @root.repository}} {{~#if @root.host}} From f1824469e46650b7e47a73354776c1a33804c766 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 27 Feb 2022 21:03:27 +0800 Subject: [PATCH 09/24] docs: add Vant 4 link (#10340) --- packages/vant/docs/markdown/changelog.en-US.md | 5 ++++- packages/vant/docs/markdown/changelog.zh-CN.md | 5 ++++- packages/vant/vant.config.mjs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/vant/docs/markdown/changelog.en-US.md b/packages/vant/docs/markdown/changelog.en-US.md index 7a121a32a..75c4f3ca2 100644 --- a/packages/vant/docs/markdown/changelog.en-US.md +++ b/packages/vant/docs/markdown/changelog.en-US.md @@ -2,7 +2,10 @@ ### Tips -The current document is the changelog of Vant 3. If you want to view the changelog of Vant 2, please visit [Vant 2 Changelog](https://youzan.github.io/vant/v2/#/en-US/changelog). +The current document is the changelog of Vant 3, other versions: + +- [Vant 2 Changelog](https://youzan.github.io/vant/v2/#/en-US/changelog) +- [Vant 4 Changelog](https://youzan.github.io/vant/v4/#/en-US/changelog) ### Intro diff --git a/packages/vant/docs/markdown/changelog.zh-CN.md b/packages/vant/docs/markdown/changelog.zh-CN.md index d53b8b96a..f0570a14a 100644 --- a/packages/vant/docs/markdown/changelog.zh-CN.md +++ b/packages/vant/docs/markdown/changelog.zh-CN.md @@ -2,7 +2,10 @@ ### 提示 -当前文档为 Vant 3 的更新日志,如需查询 Vant 2 的更新内容,请访问 [Vant 2 更新日志](https://youzan.github.io/vant/v2/#/zh-CN/changelog)。 +当前文档为 Vant 3 的更新日志,其他版本请参考: + +- [Vant 2 更新日志](https://youzan.github.io/vant/v2/#/zh-CN/changelog) +- [Vant 4 更新日志](https://youzan.github.io/vant/v4/#/zh-CN/changelog) ### 介绍 diff --git a/packages/vant/vant.config.mjs b/packages/vant/vant.config.mjs index e4669ef5e..dec76a87e 100644 --- a/packages/vant/vant.config.mjs +++ b/packages/vant/vant.config.mjs @@ -18,6 +18,7 @@ export default { versions: [ { label: 'v1', link: '/vant/v1/' }, { label: 'v2', link: '/vant/v2/' }, + { label: 'v4', link: '/vant/v4/' }, ], baiduAnalytics: { seed: 'ad6b5732c36321f2dafed737ac2da92f', From e9451af1be970f9eac5028980a317138b60439e5 Mon Sep 17 00:00:00 2001 From: little-huang <53588889+little-huang@users.noreply.github.com> Date: Mon, 28 Feb 2022 17:09:33 +0800 Subject: [PATCH 10/24] docs: modify JSX.ELement to JSX.Element (#10344) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 黄宝成 --- packages/vant/src/dialog/README.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant/src/dialog/README.zh-CN.md b/packages/vant/src/dialog/README.zh-CN.md index c88ffdcba..5e3354929 100644 --- a/packages/vant/src/dialog/README.zh-CN.md +++ b/packages/vant/src/dialog/README.zh-CN.md @@ -222,7 +222,7 @@ export default { | v-model:show | 是否显示弹窗 | _boolean_ | - | | title | 标题 | _string_ | - | | width | 弹窗宽度,默认单位为 `px` | _number \| string_ | `320px` | -| message | 文本内容,支持通过 `\n` 换行 | _string \| () => JSX.ELement_ | - | +| message | 文本内容,支持通过 `\n` 换行 | _string \| () => JSX.Element_ | - | | message-align | 内容水平对齐方式,可选值为 `left` `right` | _string_ | `center` | | theme | 样式风格,可选值为 `round-button` | _string_ | `default` | | show-confirm-button | 是否展示确认按钮 | _boolean_ | `true` | From bc4e1cd17e932e52aec7adca56981e3b28cfb5a8 Mon Sep 17 00:00:00 2001 From: ready-research <72916209+ready-research@users.noreply.github.com> Date: Thu, 3 Mar 2022 13:39:07 +0530 Subject: [PATCH 11/24] fix(vant-cli): decamelize ReDoS (#10351) * [Security] Fix ReDoS Fix ReDoS * Fix ReDoS Fix ReDoS --- packages/vant-cli/site/common/index.js | 2 +- packages/vant-cli/src/common/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vant-cli/site/common/index.js b/packages/vant-cli/site/common/index.js index dcfb367e9..166c9f1ef 100644 --- a/packages/vant-cli/site/common/index.js +++ b/packages/vant-cli/site/common/index.js @@ -4,7 +4,7 @@ const isMobile = /ios|iphone|ipod|ipad|android/.test(ua); export function decamelize(str, sep = '-') { return str .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') - .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') + .replace(/([A-Z])([A-Z][a-z\d]+)/g, '$1' + sep + '$2') .toLowerCase(); } diff --git a/packages/vant-cli/src/common/index.ts b/packages/vant-cli/src/common/index.ts index 2bbe6d085..bb027de5c 100644 --- a/packages/vant-cli/src/common/index.ts +++ b/packages/vant-cli/src/common/index.ts @@ -72,7 +72,7 @@ export function pascalize(str: string): string { export function decamelize(str: string, sep = '-') { return str .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') - .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') + .replace(/([A-Z])([A-Z][a-z\d]+)/g, '$1' + sep + '$2') .toLowerCase(); } From 202efbbf85ec94f7d804075d1ecbfb71c6824cb4 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Thu, 3 Mar 2022 16:26:35 +0800 Subject: [PATCH 12/24] release: @vant/cli 4.0.1 --- packages/vant-cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index a065f757f..8e01e0829 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -1,6 +1,6 @@ { "name": "@vant/cli", - "version": "4.0.0", + "version": "4.0.1", "type": "module", "main": "lib/index.js", "typings": "lib/index.d.ts", From 3d4247ab15ac4cfb26f11df909293c1742f46402 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 6 Mar 2022 10:37:45 +0800 Subject: [PATCH 13/24] feat: add van-safe-area-top class (#10356) --- packages/vant/src/nav-bar/NavBar.tsx | 7 +++++-- packages/vant/src/nav-bar/test/index.spec.ts | 2 +- packages/vant/src/style/README.md | 8 ++++++-- packages/vant/src/style/README.zh-CN.md | 8 ++++++-- packages/vant/src/style/base.less | 5 +++++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/vant/src/nav-bar/NavBar.tsx b/packages/vant/src/nav-bar/NavBar.tsx index e8a867e4a..86142c3c9 100644 --- a/packages/vant/src/nav-bar/NavBar.tsx +++ b/packages/vant/src/nav-bar/NavBar.tsx @@ -82,8 +82,11 @@ export default defineComponent({ ref={navBarRef} style={style} class={[ - bem({ fixed, 'safe-area-inset-top': props.safeAreaInsetTop }), - { [BORDER_BOTTOM]: border }, + bem({ fixed }), + { + [BORDER_BOTTOM]: border, + 'van-safe-area-top': props.safeAreaInsetTop, + }, ]} >
diff --git a/packages/vant/src/nav-bar/test/index.spec.ts b/packages/vant/src/nav-bar/test/index.spec.ts index 8d5cf699b..584e06a7b 100644 --- a/packages/vant/src/nav-bar/test/index.spec.ts +++ b/packages/vant/src/nav-bar/test/index.spec.ts @@ -74,7 +74,7 @@ test('should have safe-area-inset-top class when using safe-area-inset-top prop' }, }); - expect(wrapper.classes()).toContain('van-nav-bar--safe-area-inset-top'); + expect(wrapper.classes()).toContain('van-safe-area-top'); }); test('should change z-index when using z-index prop', () => { diff --git a/packages/vant/src/style/README.md b/packages/vant/src/style/README.md index fcbcdb223..22b13979f 100644 --- a/packages/vant/src/style/README.md +++ b/packages/vant/src/style/README.md @@ -49,11 +49,15 @@ Add 1px border under the Retina screen for the element, based on a pseudo elemen
``` -### Safe Area Bottom +### Safe Area -Enable safe area inset bottom. +Enable safe area. ```html + +
+ +
``` diff --git a/packages/vant/src/style/README.zh-CN.md b/packages/vant/src/style/README.zh-CN.md index 2e6e4ab68..6ac9e0e4d 100644 --- a/packages/vant/src/style/README.zh-CN.md +++ b/packages/vant/src/style/README.zh-CN.md @@ -47,11 +47,15 @@ Vant 中默认包含了一些常用样式,可以直接通过 className 的方
``` -### 底部安全区 +### 安全区 -为元素添加底部安全区适配。 +为元素添加安全区适配。 ```html + +
+ +
``` diff --git a/packages/vant/src/style/base.less b/packages/vant/src/style/base.less index 3b493208e..29d127811 100644 --- a/packages/vant/src/style/base.less +++ b/packages/vant/src/style/base.less @@ -26,6 +26,11 @@ .multi-ellipsis(3); } +.van-safe-area-top { + padding-top: constant(safe-area-inset-top); + padding-top: env(safe-area-inset-top); +} + .van-safe-area-bottom { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); From 220efc05cae11ea986e145b2bc5941d1e7bc77be Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 6 Mar 2022 10:54:22 +0800 Subject: [PATCH 14/24] feat(Popup): add safe-area-inset-top prop (#10357) --- packages/vant/src/popup/Popup.tsx | 8 +++++-- packages/vant/src/popup/README.md | 1 + packages/vant/src/popup/README.zh-CN.md | 1 + packages/vant/src/popup/test/index.spec.jsx | 24 +++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/vant/src/popup/Popup.tsx b/packages/vant/src/popup/Popup.tsx index a8235a6be..ec73d92e8 100644 --- a/packages/vant/src/popup/Popup.tsx +++ b/packages/vant/src/popup/Popup.tsx @@ -48,6 +48,7 @@ const popupProps = extend({}, popupSharedProps, { iconPrefix: String, closeOnPopstate: Boolean, closeIconPosition: makeStringProp('top-right'), + safeAreaInsetTop: Boolean, safeAreaInsetBottom: Boolean, }); @@ -177,7 +178,7 @@ export default defineComponent({ const onKeydown = (event: KeyboardEvent) => emit('keydown', event); const renderPopup = lazyRender(() => { - const { round, position, safeAreaInsetBottom } = props; + const { round, position, safeAreaInsetTop, safeAreaInsetBottom } = props; return (
{ await wrapper.setProps({ show: false }); expect(beforeClose).toHaveBeenCalledTimes(0); }); + +test('should have safe-area-inset-top class when using safe-area-inset-top prop', () => { + const wrapper = mount(Popup, { + props: { + show: true, + safeAreaInsetTop: true, + }, + }); + + expect(wrapper.find('.van-popup').classes()).toContain('van-safe-area-top'); +}); + +test('should have safe-area-inset-bottom class when using safe-area-inset-bottom prop', () => { + const wrapper = mount(Popup, { + props: { + show: true, + safeAreaInsetBottom: true, + }, + }); + + expect(wrapper.find('.van-popup').classes()).toContain( + 'van-safe-area-bottom' + ); +}); From bc7afd703797a78c1001f764681caf2a7cdb6d7c Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 6 Mar 2022 10:57:36 +0800 Subject: [PATCH 15/24] feat(Calendar): add safe-area-inset-top prop (#10358) --- packages/vant/src/calendar/Calendar.tsx | 2 ++ packages/vant/src/calendar/README.md | 1 + packages/vant/src/calendar/README.zh-CN.md | 1 + 3 files changed, 4 insertions(+) diff --git a/packages/vant/src/calendar/Calendar.tsx b/packages/vant/src/calendar/Calendar.tsx index 55d2970f3..6ddfa66c8 100644 --- a/packages/vant/src/calendar/Calendar.tsx +++ b/packages/vant/src/calendar/Calendar.tsx @@ -79,6 +79,7 @@ const calendarProps = { showRangePrompt: truthProp, confirmDisabledText: String, closeOnClickOverlay: truthProp, + safeAreaInsetTop: Boolean, safeAreaInsetBottom: truthProp, minDate: { type: Date, @@ -565,6 +566,7 @@ export default defineComponent({ closeable={props.showTitle || props.showSubtitle} teleport={props.teleport} closeOnPopstate={props.closeOnPopstate} + safeAreaInsetTop={props.safeAreaInsetTop} closeOnClickOverlay={props.closeOnClickOverlay} onUpdate:show={updateShow} /> diff --git a/packages/vant/src/calendar/README.md b/packages/vant/src/calendar/README.md index 699bb5376..3fda11f1e 100644 --- a/packages/vant/src/calendar/README.md +++ b/packages/vant/src/calendar/README.md @@ -279,6 +279,7 @@ Following props are supported when the poppable is true | round | Whether to show round corner | _boolean_ | `true` | | close-on-popstate | Whether to close when popstate | _boolean_ | `true` | | close-on-click-overlay | Whether to close when overlay is clicked | _boolean_ | `true` | +| safe-area-inset-top | Whether to enable top safe area adaptation | _boolean_ | `false` | | safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `true` | | teleport | Specifies a target element where Calendar will be mounted | _string \| Element_ | - | diff --git a/packages/vant/src/calendar/README.zh-CN.md b/packages/vant/src/calendar/README.zh-CN.md index 556a18cc4..827817593 100644 --- a/packages/vant/src/calendar/README.zh-CN.md +++ b/packages/vant/src/calendar/README.zh-CN.md @@ -283,6 +283,7 @@ export default { | round | 是否显示圆角弹窗 | _boolean_ | `true` | | close-on-popstate | 是否在页面回退时自动关闭 | _boolean_ | `true` | | close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` | +| safe-area-inset-top | 是否开启[顶部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `false` | | safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` | | teleport | 指定挂载的节点,等同于 Teleport 组件的 [to 属性](https://v3.cn.vuejs.org/api/built-in-components.html#teleport) | _string \| Element_ | - | From b0849c03e55163cf6461c11870a6f215d9ae7dbc Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 9 Mar 2022 18:43:08 +0800 Subject: [PATCH 16/24] types: fix missing VisibilityState after typescript 4.6.0 (#10370) --- packages/vant-use/src/usePageVisibility/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/vant-use/src/usePageVisibility/index.ts b/packages/vant-use/src/usePageVisibility/index.ts index e63996815..883c606b1 100644 --- a/packages/vant-use/src/usePageVisibility/index.ts +++ b/packages/vant-use/src/usePageVisibility/index.ts @@ -1,6 +1,8 @@ import { ref, Ref } from 'vue'; import { inBrowser } from '../utils'; +type VisibilityState = "hidden" | "visible"; + let visibility: Ref; export function usePageVisibility() { From 1040afdda6e6f8bb98ea36cbc9212b65ecb8c49b Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Wed, 9 Mar 2022 18:47:05 +0800 Subject: [PATCH 17/24] release: @vant/use 1.3.6 --- packages/vant-use/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant-use/package.json b/packages/vant-use/package.json index dc2cea308..f6dd0c2c3 100644 --- a/packages/vant-use/package.json +++ b/packages/vant-use/package.json @@ -1,6 +1,6 @@ { "name": "@vant/use", - "version": "1.3.5", + "version": "1.3.6", "description": "Vant Composition API", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", From f95239006cf23665593c8316258f4cec4237f29a Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Wed, 9 Mar 2022 18:48:06 +0800 Subject: [PATCH 18/24] docs(@vant/use): changelog 1.3.6 --- packages/vant-use/changelog.md | 4 ++++ packages/vant/package.json | 2 +- pnpm-lock.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vant-use/changelog.md b/packages/vant-use/changelog.md index baf0cfc9f..50d60899d 100644 --- a/packages/vant-use/changelog.md +++ b/packages/vant-use/changelog.md @@ -1,5 +1,9 @@ # Changelog +## v1.3.6 + +- Fix missing VisibilityState type + ## v1.3.5 - Fix useChildren missing subTree when flattening vnodes diff --git a/packages/vant/package.json b/packages/vant/package.json index 88347cba9..b21332eb4 100644 --- a/packages/vant/package.json +++ b/packages/vant/package.json @@ -63,7 +63,7 @@ "dependencies": { "@vant/icons": "^1.7.1", "@vant/popperjs": "^1.1.0", - "@vant/use": "^1.3.5" + "@vant/use": "^1.3.6" }, "peerDependencies": { "vue": "^3.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54cebfd3e..718727aeb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,7 +54,7 @@ importers: '@vant/eslint-config': workspace:* '@vant/icons': ^1.7.1 '@vant/popperjs': ^1.1.0 - '@vant/use': ^1.3.5 + '@vant/use': ^1.3.6 '@vue/runtime-core': ^3.2.27 '@vue/test-utils': ^2.0.0-rc.16 typescript: ~4.5.2 From 3c953b47b0b768eea70c4ac7ed9593b2abe94978 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 13 Mar 2022 15:33:08 +0800 Subject: [PATCH 19/24] docs: add mirror repo description (#10382) --- packages/vant/docs/markdown/contribution.zh-CN.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/vant/docs/markdown/contribution.zh-CN.md b/packages/vant/docs/markdown/contribution.zh-CN.md index 1f95063a1..8f2c9d544 100644 --- a/packages/vant/docs/markdown/contribution.zh-CN.md +++ b/packages/vant/docs/markdown/contribution.zh-CN.md @@ -36,6 +36,16 @@ pnpm dev - dev 分支对应 Vant 3 版本 ,适用于 Vue 3 - next 分支对应 Vant 4 版本,适用于 Vue 3 +### 镜像仓库 + +如果 GitHub 克隆速度较慢,你也可以直接克隆 Vant 在 gitee 上的[镜像仓库](https://gitee.com/vant-contrib/vant): + +```bash +git clone git@gitee.com:vant-contrib/vant.git +``` + +镜像仓库仅用于加快国内的访问速度,请勿在镜像仓库中提 issue 和 Pull Request。 + ### 目录结构 Vant 采用 monorepo 进行代码管理,所有子包在 `packages` 目录下: From 09694feaad25d2b81868adf2c0b1b4343d41d960 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 13 Mar 2022 15:40:56 +0800 Subject: [PATCH 20/24] docs(Field): add v-model type guide (#10383) --- packages/vant/src/field/README.zh-CN.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/vant/src/field/README.zh-CN.md b/packages/vant/src/field/README.zh-CN.md index c8cc26688..75aafe688 100644 --- a/packages/vant/src/field/README.zh-CN.md +++ b/packages/vant/src/field/README.zh-CN.md @@ -405,6 +405,16 @@ fieldRef.value?.focus(); HTML 原生的 `type="number"` 属性在 iOS 和 Android 系统上都存在一定问题,比如 maxlength 属性不生效、无法获取到完整的输入内容等。因此设置 type 为 `number` 时,Field 不会使用原生的 `type="number"` 属性,而是用现代浏览器支持的 [inputmode 属性](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/inputmode)来控制输入键盘的类型。 +### 为什么 v-model 绑定的值被更新为 string 类型? + +Field 组件内部会将传入的 v-model 格式化为 string 类型,便于组件内部进行处理。 + +如果你希望在 v-model 上绑定 number 类型,可以使用 Vue 提供的 [.number 修饰符](https://vuejs.org/guide/essentials/forms.html#lazy)。 + +```html + +``` + ### 在桌面端点击清除按钮无效? 清除按钮监听是的移动端 Touch 事件,参见[桌面端适配](#/zh-CN/advanced-usage#zhuo-mian-duan-gua-pei)。 From 3bb729214e08381cace9ce188af4e17424e2b28a Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 13 Mar 2022 15:51:10 +0800 Subject: [PATCH 21/24] fix(Skeleton): fix non-props attributes warning (#10384) --- packages/vant/src/skeleton/Skeleton.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/vant/src/skeleton/Skeleton.tsx b/packages/vant/src/skeleton/Skeleton.tsx index 7ac2f1b0d..3a75cea39 100644 --- a/packages/vant/src/skeleton/Skeleton.tsx +++ b/packages/vant/src/skeleton/Skeleton.tsx @@ -38,9 +38,11 @@ export type SkeletonProps = ExtractPropTypes; export default defineComponent({ name, + inheritAttrs: false, + props: skeletonProps, - setup(props, { slots }) { + setup(props, { slots, attrs }) { const renderAvatar = () => { if (props.avatar) { return ( @@ -90,7 +92,10 @@ export default defineComponent({ } return ( -
+
{renderAvatar()}
{renderTitle()} From fc89c7dd06acbb0f70cbe9fea211158f29b19d7d Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 13 Mar 2022 16:05:48 +0800 Subject: [PATCH 22/24] docs(Calendar): add formatter async usage (#10385) --- packages/vant/src/calendar/README.zh-CN.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/vant/src/calendar/README.zh-CN.md b/packages/vant/src/calendar/README.zh-CN.md index 827817593..a5a91c1de 100644 --- a/packages/vant/src/calendar/README.zh-CN.md +++ b/packages/vant/src/calendar/README.zh-CN.md @@ -416,6 +416,28 @@ calendarRef.value?.reset(); ## 常见问题 +### 如何在 formatter 中使用异步返回的数据? + +如果需要在 formatter 中使用异步返回的数据,可以使用计算属性动态创建 formatter 函数,示例如下: + +```js +const asyncData = ref(); + +const formatter = computed(() => { + if (!asyncData.value) { + return (day) => day; + } + return (day) => { + day.bottomInfo = asyncData.value; + return day; + }; +}); + +setTimeout(() => { + asyncData.value = '后端文案'; +}, 3000); +``` + ### 在 iOS 系统上初始化组件失败? 如果你遇到了在 iOS 上无法渲染组件的问题,请确认在创建 Date 对象时没有使用`new Date('2020-01-01')`这样的写法,iOS 不支持以中划线分隔的日期格式,正确写法是`new Date('2020/01/01')`。 From 1cfa46e9219b2d0dac04e3657395c306df90a87a Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 13 Mar 2022 16:21:56 +0800 Subject: [PATCH 23/24] release: 3.4.6 --- packages/vant/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant/package.json b/packages/vant/package.json index b21332eb4..b3d0d3ad9 100644 --- a/packages/vant/package.json +++ b/packages/vant/package.json @@ -1,6 +1,6 @@ { "name": "vant", - "version": "3.4.5", + "version": "3.4.6", "description": "Mobile UI Components built on Vue", "main": "lib/vant.cjs.js", "module": "es/index.js", From 0dc490c9bca4206b4050824bf707094027ed5872 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 13 Mar 2022 16:26:03 +0800 Subject: [PATCH 24/24] docs(changelog): 3.4.6 --- packages/vant/docs/markdown/changelog.en-US.md | 17 +++++++++++++++++ packages/vant/docs/markdown/changelog.zh-CN.md | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/packages/vant/docs/markdown/changelog.en-US.md b/packages/vant/docs/markdown/changelog.en-US.md index 75c4f3ca2..6053d8498 100644 --- a/packages/vant/docs/markdown/changelog.en-US.md +++ b/packages/vant/docs/markdown/changelog.en-US.md @@ -19,6 +19,23 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/). ## Details +### [v3.4.6](https://github.com/youzan/vant/compare/v3.4.5...v3.4.6) + +`2022-03-13` + +**Feature** + +- Style: add van-safe-area-top class [#10356](https://github.com/youzan/vant/issues/10356) +- Calendar: add safe-area-inset-top prop [#10358](https://github.com/youzan/vant/issues/10358) +- Popup: add safe-area-inset-top prop [#10357](https://github.com/youzan/vant/issues/10357) + +**Bug Fixes** + +- Skeleton: fix non-props attributes warning [#10384](https://github.com/youzan/vant/issues/10384) +- SwipeCell: cell should stopPropagation when lockClick is true [#10319](https://github.com/youzan/vant/issues/10319) +- Toast: failed to render message after changing type [#10311](https://github.com/youzan/vant/issues/10311) +- fix missing VisibilityState after typescript 4.6.0 [#10370](https://github.com/youzan/vant/issues/10370) + ### [v3.4.5](https://github.com/compare/v3.4.3...v3.4.5) `2022-02-14` diff --git a/packages/vant/docs/markdown/changelog.zh-CN.md b/packages/vant/docs/markdown/changelog.zh-CN.md index f0570a14a..e50ff912c 100644 --- a/packages/vant/docs/markdown/changelog.zh-CN.md +++ b/packages/vant/docs/markdown/changelog.zh-CN.md @@ -19,6 +19,23 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。 ## 更新内容 +### [v3.4.6](https://github.com/youzan/vant/compare/v3.4.5...v3.4.6) + +`2022-03-13` + +**Feature** + +- Style: 新增 van-safe-area-top 样式类 [#10356](https://github.com/youzan/vant/issues/10356) +- Calendar: 新增 safe-area-inset-top 属性 [#10358](https://github.com/youzan/vant/issues/10358) +- Popup: 新增 safe-area-inset-top 属性 [#10357](https://github.com/youzan/vant/issues/10357) + +**Bug Fixes** + +- Skeleton: 修复个别情况下出现 non-props attributes warning 的问题 [#10384](https://github.com/youzan/vant/issues/10384) +- SwipeCell: 修复阻止滑动事件冒泡无效的问题 [#10319](https://github.com/youzan/vant/issues/10319) +- Toast: 修复切换 type 时 message 不显示的问题 [#10311](https://github.com/youzan/vant/issues/10311) +- 修复提示 VisibilityState 类型不存在的问题 [#10370](https://github.com/youzan/vant/issues/10370) + ### [v3.4.5](https://github.com/compare/v3.4.3...v3.4.5) `2022-02-14`