[new feature] Actionsheet: add safe-area-inset-bottom prop (#3171)

This commit is contained in:
neverland 2019-04-18 17:47:44 +08:00 committed by GitHub
parent 2b44f1a8dd
commit 83daca3f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
<meta http-Equiv="Cache-Control" Content="no-cache" />
<meta http-Equiv="Pragma" Content="no-cache" />
<meta http-Equiv="Expires" Content="0" />

View File

@ -85,6 +85,7 @@ Actionsheet will get another style if there is a `title` prop.
| close-on-click-overlay | Whether to close when click overlay | `Boolean` | `true` |
| lazy-render | Whether to lazy render util appeared | `Boolean` | `true` |
| get-container | Return the mount node for actionsheet | `String | () => HTMLElement` | - |
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation, to enable those features use `viewport-fit=cover` in the `viewport` meta tag | `Boolean` | `false` |
### Event

View File

@ -60,4 +60,9 @@
color: @action-sheet-close-icon-color;
font-size: @action-sheet-close-icon-size;
}
&--safe-area-inset-bottom {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
}

View File

@ -23,6 +23,7 @@ export type ActionsheetProps = PopupMixinProps & {
title?: string;
actions: ActionsheetItem[];
cancelText?: string;
safeAreaInsetBottom?: boolean;
};
const [sfc, bem] = use('actionsheet');
@ -79,7 +80,7 @@ function Actionsheet(
return (
<Popup
class={bem()}
class={bem({ 'safe-area-inset-bottom': props.safeAreaInsetBottom })}
value={props.value}
position="bottom"
overlay={props.overlay}
@ -107,6 +108,7 @@ Actionsheet.props = {
title: String,
actions: Array,
cancelText: String,
safeAreaInsetBottom: Boolean,
overlay: {
type: Boolean,
default: true

View File

@ -90,6 +90,7 @@ export default {
| close-on-click-overlay | 是否在点击蒙层后关闭 | `Boolean` | `true` | - |
| lazy-render | 是否在显示弹层时才渲染节点 | `Boolean` | `true` | 1.1.11 |
| get-container | 指定挂载的节点,可以传入选择器,<br>或一个返回节点的函数 | `String | () => HTMLElement` | - | - |
| safe-area-inset-bottom | 是否开启 iPhone X 底部安全区适配,需要在 `viewport` meta 标签中设置 `viewport-fit=cover` | `Boolean` | `false` | 1.6.15 |
### Event

View File

@ -69,9 +69,9 @@ export default {
|------|------|------|------|
| v-model | Index of current tab | `Number` | - |
| fixed | Whether to fixed bottom | `Boolean` | `true` |
| safe-area-inset-bottom | Whether to iPhone X bottom safe area adaptation, to enable those features use `viewport-fit=cover` in the `viewport` meta tag | `Boolean` | `false` | 1.6.15 |
| z-index | Z-index | `Number` | `1` |
| active-color | Color of active tab item | `String` | `#1989fa` |
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation, to enable those features use `viewport-fit=cover` in the `viewport` meta tag | `Boolean` | `false` |
### Tabbar Event

View File

@ -12,14 +12,11 @@ export default sfc({
props: {
value: Number,
activeColor: String,
safeAreaInsetBottom: Boolean,
fixed: {
type: Boolean,
default: true
},
safeAreaInsetBottom: {
type: Boolean,
default: false
},
zIndex: {
type: Number,
default: 1

View File

@ -13,7 +13,6 @@
}
&--safe-area-inset-bottom {
padding-bottom: 0;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}

View File

@ -84,9 +84,9 @@ export default {
|------|------|------|------|------|
| v-model | 当前选中标签的索引 | `Number` | - | - |
| fixed | 是否固定在底部 | `Boolean` | `true` | - |
| safe-area-inset-bottom | 是否开启 iPhone X 底部安全区适配,同时需要在 `viewport` meta 标签中设置 `viewport-fit=cover` | `Boolean` | `false` | 1.6.15 |
| z-index | 元素 z-index | `Number` | `1` | 1.1.9 |
| active-color | 选中标签的颜色 | `String` | `#1989fa` | 1.5.1 |
| safe-area-inset-bottom | 是否开启 iPhone X 底部安全区适配,需要在 `viewport` meta 标签中设置 `viewport-fit=cover` | `Boolean` | `false` | 1.6.15 |
### Tabbar Event