feat(ShareSheet): add popup props

This commit is contained in:
chenjiahan 2020-04-09 11:33:20 +08:00 committed by neverland
parent 1d07aa88ba
commit e2a7fc7c95
3 changed files with 36 additions and 0 deletions

View File

@ -101,6 +101,14 @@ export default {
| title | Title | *string* | - |
| cancel-text | Cancel button text | *string* | `'Cancel'` |
| description | Description | *string* | - |
| duration | Transition duration, unit second | *number \| string* | `0.3` |
| overlay | Whether to show overlay | *boolean* | `true` |
| lock-scroll | Whether to lock background scroll | *boolean* | `true` |
| lazy-render | Whether to lazy render util appeared | *boolean* | `true` |
| close-on-popstate | Whether to close when popstate | *boolean* | `true` |
| close-on-click-overlay | Whether to close when click overlay | *boolean* | `true` |
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation | *boolean* | `true` |
| get-container | Return the mount node for ShareSheet | *string \| () => Element* | - |
### Data Structure of Option

View File

@ -134,6 +134,14 @@ export default {
| title | 顶部标题 | *string* | - |
| cancel-text | 取消按钮文字 | *string* | `'取消'` |
| description | 标题下方的辅助描述文字 | *string* | - |
| duration | 动画时长,单位秒 | *number \| string* | `0.3` |
| overlay | 是否显示遮罩层 | *boolean* | `true` |
| lock-scroll | 是否锁定背景滚动 | *boolean* | `true` |
| lazy-render | 是否在显示弹层时才渲染内容 | *boolean* | `true` |
| close-on-popstate | 是否在页面回退时自动关闭 | *boolean* | `true` |
| close-on-click-overlay | 是否在点击遮罩层后关闭 | *boolean* | `true` |
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | *boolean* | `true` |
| get-container | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | *string \| () => Element* | - |
### Option 数据结构

View File

@ -17,14 +17,27 @@ export default createComponent({
title: String,
cancelText: String,
description: String,
getContainer: [String, Function],
options: {
type: Array,
default: () => [],
},
overlay: {
type: Boolean,
default: true,
},
closeOnPopstate: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
},
methods: {
@ -111,6 +124,13 @@ export default createComponent({
class={bem()}
value={this.value}
position="bottom"
overlay={this.overlay}
duration={this.duration}
lazyRender={this.lazyRender}
lockScroll={this.lockScroll}
getContainer={this.getContainer}
closeOnPopstate={this.closeOnPopstate}
closeOnClickOverlay={this.closeOnClickOverlay}
safeAreaInsetBottom={this.safeAreaInsetBottom}
onInput={this.toggle}
>