+
`;
exports[`title-left slot 1`] = `
-
+
Custom Title Left
1234567890删除
diff --git a/src/password-input/test/__snapshots__/demo.spec.js.snap b/src/password-input/test/__snapshots__/demo.spec.js.snap
index c1e2c70dd..3078bb1cc 100644
--- a/src/password-input/test/__snapshots__/demo.spec.js.snap
+++ b/src/password-input/test/__snapshots__/demo.spec.js.snap
@@ -16,7 +16,7 @@ exports[`renders demo correctly 1`] = `
密码为 6 位数字
-
diff --git a/src/tabbar/README.zh-CN.md b/src/tabbar/README.zh-CN.md
index 8dea31eb0..fd224facf 100644
--- a/src/tabbar/README.zh-CN.md
+++ b/src/tabbar/README.zh-CN.md
@@ -170,7 +170,7 @@ export default {
| active-color | 选中标签的颜色 | *string* | `#1989fa` |
| inactive-color | 未选中标签的颜色 | *string* | `#7d7e80` |
| route | 是否开启路由模式 | *boolean* | `false` |
-| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | *boolean* | `false` |
+| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei),设置 fixed 时默认开启 | *boolean* | `false` |
### Tabbar Events
diff --git a/src/tabbar/demo/index.vue b/src/tabbar/demo/index.vue
index 40717a09d..47535eae6 100644
--- a/src/tabbar/demo/index.vue
+++ b/src/tabbar/demo/index.vue
@@ -127,6 +127,7 @@ export default {
.demo-tabbar {
.van-tabbar {
position: relative;
+ padding-bottom: 0;
}
}
diff --git a/src/tabbar/index.js b/src/tabbar/index.js
index 2cfb7baa2..4193e7047 100644
--- a/src/tabbar/index.js
+++ b/src/tabbar/index.js
@@ -12,7 +12,6 @@ export default createComponent({
zIndex: [Number, String],
activeColor: String,
inactiveColor: String,
- safeAreaInsetBottom: Boolean,
value: {
type: [Number, String],
default: 0,
@@ -25,6 +24,20 @@ export default createComponent({
type: Boolean,
default: true,
},
+ safeAreaInsetBottom: {
+ type: Boolean,
+ default: null,
+ },
+ },
+
+ computed: {
+ fit() {
+ if (this.safeAreaInsetBottom !== null) {
+ return this.safeAreaInsetBottom;
+ }
+ // enable safe-area-inset-bottom by default when fixed
+ return this.fixed;
+ },
},
watch: {
@@ -54,8 +67,8 @@ export default createComponent({
class={[
{ [BORDER_TOP_BOTTOM]: this.border },
bem({
+ unfit: !this.fit,
fixed: this.fixed,
- 'safe-area-inset-bottom': this.safeAreaInsetBottom,
}),
]}
>
diff --git a/src/tabbar/index.less b/src/tabbar/index.less
index a1a32bce2..fe25f9328 100644
--- a/src/tabbar/index.less
+++ b/src/tabbar/index.less
@@ -6,6 +6,8 @@
box-sizing: content-box;
width: 100%;
height: @tabbar-height;
+ padding-bottom: constant(safe-area-inset-bottom);
+ padding-bottom: env(safe-area-inset-bottom);
background-color: @tabbar-background-color;
&--fixed {
@@ -14,8 +16,7 @@
left: 0;
}
- &--safe-area-inset-bottom {
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
+ &--unfit {
+ padding-bottom: 0;
}
}