feat(NumberKeyboard): add get-container prop (#6870)

This commit is contained in:
neverland 2020-07-25 10:47:47 +08:00 committed by GitHub
parent 08a554c5a2
commit 2328983afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,7 @@ function getElement(selector) {
return selector(); return selector();
} }
export function PortalMixin({ ref, afterPortal }) { export function PortalMixin({ ref, afterPortal } = {}) {
return { return {
props: { props: {
getContainer: [String, Function], getContainer: [String, Function],

View File

@ -160,6 +160,7 @@ export default {
| close-button-loading `v2.7.0` | Whether to show loading close button in custom theme | _boolean_ | `false` | | close-button-loading `v2.7.0` | Whether to show loading close button in custom theme | _boolean_ | `false` |
| show-delete-key `v2.5.9` | Whether to show delete button | _boolean_ | `true` | | show-delete-key `v2.5.9` | Whether to show delete button | _boolean_ | `true` |
| hide-on-click-outside | Whether to hide keyboard when click outside | _boolean_ | `true` | | hide-on-click-outside | Whether to hide keyboard when click outside | _boolean_ | `true` |
| get-container `v2.10.0` | Return the mount node for NumberKeyboard | _string \| () => Element_ | - |
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `true` | | safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `true` |
### Events ### Events

View File

@ -173,6 +173,7 @@ export default {
| close-button-loading `v2.7.0` | 是否将关闭按钮设置为加载中状态,仅在 `theme="custom"` 时有效 | _boolean_ | `false` | | close-button-loading `v2.7.0` | 是否将关闭按钮设置为加载中状态,仅在 `theme="custom"` 时有效 | _boolean_ | `false` |
| show-delete-key `v2.5.9` | 是否展示删除图标 | _boolean_ | `true` | | show-delete-key `v2.5.9` | 是否展示删除图标 | _boolean_ | `true` |
| hide-on-click-outside | 点击外部时是否收起键盘 | _boolean_ | `true` | | hide-on-click-outside | 点击外部时是否收起键盘 | _boolean_ | `true` |
| get-container `v2.10.0` | 指定挂载的节点,[用法示例](#/zh-CN/popup#zhi-ding-gua-zai-wei-zhi) | _string \| () => Element_ | - |
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` | | safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei) | _boolean_ | `true` |
### Events ### Events

View File

@ -1,5 +1,6 @@
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
import { stopPropagation } from '../utils/dom/event'; import { stopPropagation } from '../utils/dom/event';
import { PortalMixin } from '../mixins/portal';
import { BindEventMixin } from '../mixins/bind-event'; import { BindEventMixin } from '../mixins/bind-event';
import Key from './Key'; import Key from './Key';
@ -7,6 +8,7 @@ const [createComponent, bem] = createNamespace('number-keyboard');
export default createComponent({ export default createComponent({
mixins: [ mixins: [
PortalMixin(),
BindEventMixin(function (bind) { BindEventMixin(function (bind) {
if (this.hideOnClickOutside) { if (this.hideOnClickOutside) {
bind(document.body, 'touchstart', this.onBlur); bind(document.body, 'touchstart', this.onBlur);