From df238651c2d5e238a1ffbe4cf661756308fc4aa7 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 11 Dec 2018 16:05:13 +0800 Subject: [PATCH] [improvement] extract safeAreaInsetBottom to mixin (#1052) --- packages/action-sheet/index.ts | 7 +++---- packages/goods-action/index.ts | 9 +-------- packages/mixins/iphonex.ts | 7 +++++++ packages/popup/index.ts | 4 ---- packages/submit-bar/index.ts | 8 ++------ packages/tabbar/index.ts | 8 ++------ 6 files changed, 15 insertions(+), 28 deletions(-) diff --git a/packages/action-sheet/index.ts b/packages/action-sheet/index.ts index a1acd00f..8d2ea090 100644 --- a/packages/action-sheet/index.ts +++ b/packages/action-sheet/index.ts @@ -1,6 +1,9 @@ import { VantComponent } from '../common/component'; +import { iphonex } from '../mixins/iphonex'; VantComponent({ + mixins: [iphonex], + props: { show: Boolean, title: String, @@ -20,10 +23,6 @@ VantComponent({ closeOnClickOverlay: { type: Boolean, value: true - }, - safeAreaInsetBottom: { - type: Boolean, - value: true } }, diff --git a/packages/goods-action/index.ts b/packages/goods-action/index.ts index f6b5b374..f744bd46 100644 --- a/packages/goods-action/index.ts +++ b/packages/goods-action/index.ts @@ -2,12 +2,5 @@ import { VantComponent } from '../common/component'; import { iphonex } from '../mixins/iphonex'; VantComponent({ - mixins: [iphonex], - - props: { - safeAreaInsetBottom: { - type: Boolean, - value: true - } - } + mixins: [iphonex] }); diff --git a/packages/mixins/iphonex.ts b/packages/mixins/iphonex.ts index c8d9d0ef..4a23ed7d 100644 --- a/packages/mixins/iphonex.ts +++ b/packages/mixins/iphonex.ts @@ -19,6 +19,13 @@ function getIsIPhoneX() { } export const iphonex = Behavior({ + properties: { + safeAreaInsetBottom: { + type: Boolean, + value: true + } + }, + created() { getIsIPhoneX().then(isIPhoneX => { this.set({ isIPhoneX }); diff --git a/packages/popup/index.ts b/packages/popup/index.ts index 545d6811..8688a149 100644 --- a/packages/popup/index.ts +++ b/packages/popup/index.ts @@ -24,10 +24,6 @@ VantComponent({ position: { type: String, value: 'center' - }, - safeAreaInsetBottom: { - type: Boolean, - value: true } }, diff --git a/packages/submit-bar/index.ts b/packages/submit-bar/index.ts index ddf652de..252fb806 100644 --- a/packages/submit-bar/index.ts +++ b/packages/submit-bar/index.ts @@ -2,14 +2,14 @@ import { VantComponent } from '../common/component'; import { iphonex } from '../mixins/iphonex'; VantComponent({ + mixins: [iphonex], + classes: [ 'bar-class', 'price-class', 'button-class' ], - mixins: [iphonex], - props: { tip: null, type: Number, @@ -25,10 +25,6 @@ VantComponent({ buttonType: { type: String, value: 'danger' - }, - safeAreaInsetBottom: { - type: Boolean, - value: true } }, diff --git a/packages/tabbar/index.ts b/packages/tabbar/index.ts index cd0c5aad..3d3d6fd8 100644 --- a/packages/tabbar/index.ts +++ b/packages/tabbar/index.ts @@ -2,6 +2,8 @@ import { VantComponent } from '../common/component'; import { iphonex } from '../mixins/iphonex'; VantComponent({ + mixins: [iphonex], + relation: { name: 'tabbar-item', type: 'descendant', @@ -19,8 +21,6 @@ VantComponent({ } }, - mixins: [iphonex], - props: { active: Number, fixed: { @@ -30,10 +30,6 @@ VantComponent({ zIndex: { type: Number, value: 1 - }, - safeAreaInsetBottom: { - type: Boolean, - value: true } },