refactor(submit-bar): implement safe-area-inset-bottom with another view

fix #3080
This commit is contained in:
rex 2020-05-01 15:35:49 +08:00
parent 06d7be5bed
commit c91f346e26
2 changed files with 7 additions and 5 deletions

View File

@ -44,11 +44,11 @@
.theme(height, '@submit-bar-height'); .theme(height, '@submit-bar-height');
.theme(font-size, '@submit-bar-text-font-size'); .theme(font-size, '@submit-bar-text-font-size');
.theme(background-color, '@submit-bar-background-color'); .theme(background-color, '@submit-bar-background-color');
}
&--safe { &__safe {
padding-bottom: constant(safe-area-inset-bottom); height: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); height: env(safe-area-inset-bottom);
}
} }
&__text { &__text {

View File

@ -16,7 +16,7 @@
<slot name="tip" /> <slot name="tip" />
</view> </view>
<view class="bar-class {{ utils.bem('submit-bar__bar', { safe: safeAreaInsetBottom }) }}"> <view class="bar-class van-submit-bar__bar">
<slot /> <slot />
<view wx:if="{{ hasPrice }}" class="van-submit-bar__text"> <view wx:if="{{ hasPrice }}" class="van-submit-bar__text">
<text>{{ label || '合计:' }}</text> <text>{{ label || '合计:' }}</text>
@ -39,4 +39,6 @@
{{ loading ? '' : buttonText }} {{ loading ? '' : buttonText }}
</van-button> </van-button>
</view> </view>
<view wx:if="{{ safeAreaInsetBottom }}" class="van-submit-bar__safe" />
</view> </view>