From 7ed8c42853c76a361b16b3c21763c56a8342222d Mon Sep 17 00:00:00 2001 From: neverland <chenjiahan@youzan.com> Date: Mon, 9 Nov 2020 21:15:07 +0800 Subject: [PATCH 1/5] docs(NavBar): add safe-area-inset-top link (#7527) --- docs/markdown/advanced-usage.zh-CN.md | 7 +++++-- src/nav-bar/README.zh-CN.md | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/markdown/advanced-usage.zh-CN.md b/docs/markdown/advanced-usage.zh-CN.md index 6ffe5360a..354199bd7 100644 --- a/docs/markdown/advanced-usage.zh-CN.md +++ b/docs/markdown/advanced-usage.zh-CN.md @@ -104,7 +104,7 @@ import '@vant/touch-emulator'; ### 底部安全区适配 -iPhone X 等机型底部存在底部指示条,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行底部安全区适配。Vant 中部分组件提供了`safe-area-inset-bottom`属性,设置该属性后,即可在对应的机型上开启适配,如下示例: +iPhone X 等机型底部存在底部指示条,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行安全区适配。Vant 中部分组件提供了 `safe-area-inset-top` 或 `safe-area-inset-bottom` 属性,设置该属性后,即可在对应的机型上开启适配,如下示例: ```html <!-- 在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值 --> @@ -113,7 +113,10 @@ iPhone X 等机型底部存在底部指示条,指示条的操作区域与页 content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" /> -<!-- 开启 safe-area-inset-bottom 属性 --> +<!-- 开启顶部安全区适配 --> +<van-nav-bar safe-area-inset-top /> + +<!-- 开启底部安全区适配 --> <van-number-keyboard safe-area-inset-bottom /> ``` diff --git a/src/nav-bar/README.zh-CN.md b/src/nav-bar/README.zh-CN.md index cfad84e35..6e9c60fb4 100644 --- a/src/nav-bar/README.zh-CN.md +++ b/src/nav-bar/README.zh-CN.md @@ -65,7 +65,7 @@ export default { | fixed | 是否固定在顶部 | _boolean_ | `false` | | placeholder `v2.5.9` | 固定在顶部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | `false` | | z-index | 导航栏 z-index | _number \| string_ | `1` | -| safe-area-inset-top `v2.10.13` | 是否开启顶部安全区适配 | _boolean_ | `false` | +| safe-area-inset-top `v2.10.13` | 是否开启[顶部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `false` | ### Slots From c5124c2f6aebbe5e5ff61e97e022728fe7a7ee68 Mon Sep 17 00:00:00 2001 From: Sun <1652829889@qq.com> Date: Tue, 10 Nov 2020 21:43:03 +0800 Subject: [PATCH 2/5] fix(NavBar): safe-area-inset-top css incorrect (#7534) --- src/nav-bar/index.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nav-bar/index.less b/src/nav-bar/index.less index 8f72ac913..1fed3ee1f 100644 --- a/src/nav-bar/index.less +++ b/src/nav-bar/index.less @@ -15,8 +15,8 @@ } &--safe-area-inset-top { - padding-top: constant(safe-area-inset-bottom); - padding-top: env(safe-area-inset-bottom); + padding-top: constant(safe-area-inset-top); + padding-top: env(safe-area-inset-top); } .van-icon { From 24e8e82f3462b7ef2f97235c7293450c5d9be636 Mon Sep 17 00:00:00 2001 From: okxiaoliang4 <353742991@qq.com> Date: Tue, 10 Nov 2020 21:46:38 +0800 Subject: [PATCH 3/5] feat(Popup): add transition-appear prop (#7525) * feat:(Popup): add appear prop * docs(Popup): add appear prop * feat(Popup): add transition-appear prop --- src/mixins/popup/index.js | 2 ++ src/popup/README.md | 1 + src/popup/README.zh-CN.md | 1 + src/popup/index.js | 1 + 4 files changed, 5 insertions(+) diff --git a/src/mixins/popup/index.js b/src/mixins/popup/index.js index a0182e133..628819e93 100644 --- a/src/mixins/popup/index.js +++ b/src/mixins/popup/index.js @@ -18,6 +18,8 @@ import { PortalMixin } from '../portal'; import { CloseOnPopstateMixin } from '../close-on-popstate'; export const popupMixinProps = { + // Initial rendering animation + transitionAppear: Boolean, // whether to show popup value: Boolean, // whether to show overlay diff --git a/src/popup/README.md b/src/popup/README.md index 6956e1e06..7f66d523e 100644 --- a/src/popup/README.md +++ b/src/popup/README.md @@ -109,6 +109,7 @@ export default { | Attribute | Description | Type | Default | | --- | --- | --- | --- | | v-model (value) | Whether to show popup | _boolean_ | `false` | +| transition-appear | Initial rendering animation | _boolean_ | `false` | | overlay | Whether to show overlay | _boolean_ | `true` | | position | Can be set to `top` `bottom` `right` `left` | _string_ | `center` | | overlay-class | Custom overlay class | _string_ | - | diff --git a/src/popup/README.zh-CN.md b/src/popup/README.zh-CN.md index 90f1ce5d2..93757bad8 100644 --- a/src/popup/README.zh-CN.md +++ b/src/popup/README.zh-CN.md @@ -120,6 +120,7 @@ export default { | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | v-model (value) | 是否显示弹出层 | _boolean_ | `false` | +| transition-appear | 初始渲染动画 | _boolean_ | `false` | | overlay | 是否显示遮罩层 | _boolean_ | `true` | | position | 弹出位置,可选值为 `top` `bottom` `right` `left` | _string_ | `center` | | overlay-class | 自定义遮罩层类名 | _string_ | - | diff --git a/src/popup/index.js b/src/popup/index.js index 000db4b1f..d10199839 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -64,6 +64,7 @@ export default createComponent({ return ( <transition + appear={this.transitionAppear} name={transitionName} onAfterEnter={this.onOpened} onAfterLeave={this.onClosed} From 29dbd66c805dd7fb209e18489917a6e05e2218e1 Mon Sep 17 00:00:00 2001 From: neverland <chenjiahan@youzan.com> Date: Sat, 14 Nov 2020 08:56:46 +0800 Subject: [PATCH 4/5] feat(ImagePreview): passing current index to index slot (#7552) --- src/image-preview/ImagePreview.js | 2 +- src/image-preview/README.md | 8 ++++---- src/image-preview/README.zh-CN.md | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/image-preview/ImagePreview.js b/src/image-preview/ImagePreview.js index 9b5d6156b..1986f6372 100644 --- a/src/image-preview/ImagePreview.js +++ b/src/image-preview/ImagePreview.js @@ -140,7 +140,7 @@ export default createComponent({ if (this.showIndex) { return ( <div class={bem('index')}> - {this.slots('index') || + {this.slots('index', { index: this.active }) || `${this.active + 1} / ${this.images.length}`} </div> ); diff --git a/src/image-preview/README.md b/src/image-preview/README.md index f8e5e62c0..c1c2deae6 100644 --- a/src/image-preview/README.md +++ b/src/image-preview/README.md @@ -163,10 +163,10 @@ export default { ### Slots -| Name | Description | -| ----- | -------------------------------------------- | -| index | Custom index | -| cover | Custom content that covers the image preview | +| Name | Description | SlotProps | +| --- | --- | --- | +| index | Custom index | { index: index of current image } | +| cover | Custom content that covers the image preview | - | ### onClose Parematers diff --git a/src/image-preview/README.zh-CN.md b/src/image-preview/README.zh-CN.md index d9035a953..93b6634a1 100644 --- a/src/image-preview/README.zh-CN.md +++ b/src/image-preview/README.zh-CN.md @@ -205,10 +205,10 @@ export default { 通过组件调用 `ImagePreview` 时,支持以下插槽: -| 名称 | 说明 | -| ----- | ------------------------------ | -| index | 自定义页码内容 | -| cover | 自定义覆盖在图片预览上方的内容 | +| 名称 | 说明 | 参数 | +| ----- | ------------------------------ | ------------------------- | +| index | 自定义页码内容 | { index: 当前图片的索引 } | +| cover | 自定义覆盖在图片预览上方的内容 | - | ### onClose 回调参数 From 95227fff94cd763bab4fe4aa209439380c14b3aa Mon Sep 17 00:00:00 2001 From: chenjiahan <chenjiahan@youzan.com> Date: Sat, 14 Nov 2020 09:03:52 +0800 Subject: [PATCH 5/5] docs(Popup): update transition-appear prop --- src/popup/README.md | 2 +- src/popup/README.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/popup/README.md b/src/popup/README.md index 7f66d523e..0d6baadb2 100644 --- a/src/popup/README.md +++ b/src/popup/README.md @@ -109,7 +109,6 @@ export default { | Attribute | Description | Type | Default | | --- | --- | --- | --- | | v-model (value) | Whether to show popup | _boolean_ | `false` | -| transition-appear | Initial rendering animation | _boolean_ | `false` | | overlay | Whether to show overlay | _boolean_ | `true` | | position | Can be set to `top` `bottom` `right` `left` | _string_ | `center` | | overlay-class | Custom overlay class | _string_ | - | @@ -124,6 +123,7 @@ export default { | close-icon | Close icon name | _string_ | `cross` | | close-icon-position | Close Icon Position,can be set to `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` | | transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | _string_ | - | +| transition-appear `v2.10.14` | Whether to apply transition on initial render | _boolean_ | `false` | | get-container | Return the mount node for Popup | _string \| () => Element_ | - | | safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `false` | diff --git a/src/popup/README.zh-CN.md b/src/popup/README.zh-CN.md index 93757bad8..f834c5168 100644 --- a/src/popup/README.zh-CN.md +++ b/src/popup/README.zh-CN.md @@ -120,7 +120,6 @@ export default { | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | v-model (value) | 是否显示弹出层 | _boolean_ | `false` | -| transition-appear | 初始渲染动画 | _boolean_ | `false` | | overlay | 是否显示遮罩层 | _boolean_ | `true` | | position | 弹出位置,可选值为 `top` `bottom` `right` `left` | _string_ | `center` | | overlay-class | 自定义遮罩层类名 | _string_ | - | @@ -135,6 +134,7 @@ export default { | close-icon | 关闭图标名称或图片链接 | _string_ | `cross` | | close-icon-position | 关闭图标位置,可选值为`top-left`<br>`bottom-left` `bottom-right` | _string_ | `top-right` | | transition | 动画类名,等价于 [transtion](https://cn.vuejs.org/v2/api/index.html#transition) 的`name`属性 | _string_ | - | +| transition-appear `v2.10.14` | 是否在初始渲染时启用过渡动画 | _boolean_ | `false` | | get-container | 指定挂载的节点 | _string \| () => Element_ | - | | safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `false` |