[bugfix] Toast: line wrap in iOS (#959)

This commit is contained in:
neverland 2018-11-26 21:13:54 +08:00 committed by GitHub
parent be2f53c346
commit f0802e76c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 17 deletions

View File

@ -41,3 +41,17 @@
@notify-padding: 6px 15px; @notify-padding: 6px 15px;
@notify-font-size: 14px; @notify-font-size: 14px;
@notify-line-height: 20px; @notify-line-height: 20px;
// Toast
@toast-max-width: 70%;
@toast-font-size: 14px;
@toast-text-color: @white;
@toast-line-height: 20px;
@toast-border-radius: 4px;
@toast-background-color: rgba(0, 0, 0, .7);
@toast-icon-size: 50px;
@toast-text-min-width: 96px;
@toast-text-padding: 8px 12px;
@toast-default-padding: 15px;
@toast-default-width: 90px;
@toast-default-min-height: 90px;

View File

@ -2,44 +2,42 @@
.van-toast { .van-toast {
display: flex; display: flex;
color: @white; color: @toast-text-color;
font-size: 14px; font-size: @toast-font-size;
line-height: 20px; line-height: @toast-line-height;
border-radius: 4px; border-radius: @toast-border-radius;
word-break: break-all; word-break: break-all;
align-items: center; align-items: center;
justify-content: center;
flex-direction: column; flex-direction: column;
box-sizing: border-box; justify-content: center;
background-color: rgba(0, 0, 0, .7); box-sizing: content-box;
background-color: @toast-background-color;
&__container { &__container {
position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
max-width: 80%; max-width: @toast-max-width;
position: fixed;
// hack for avoid max-width when use left & fixed // hack for avoid max-width when use left & fixed
width: fit-content; width: fit-content;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
&--text { &--text {
min-width: 120px; padding: @toast-text-padding;
padding: 8px 12px; min-width: @toast-text-min-width;
} }
&--icon { &--icon {
width: 120px; width: @toast-default-width;
min-height: 120px; padding: @toast-default-padding;
padding: 15px; min-height: @toast-default-min-height;
.van-toast__icon { .van-toast__icon {
height: 1em; font-size: @toast-icon-size;
font-size: 50px;
} }
.van-toast__text { .van-toast__text {
font-size: 14px;
padding-top: 10px; padding-top: 10px;
} }
} }