Skip to content

Commit 81f92d9

Browse files
wind-stonedolymood
authored andcommitted
iPhone X compatible: ActionSheet、Picker (#47)
1 parent c3cbe43 commit 81f92d9

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<title>cube-ui lib</title>
66
<meta name="viewport"
7-
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover">
88
</head>
99
<body>
1010
<div id="app"></div>

src/common/stylus/base.styl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@require "./variable.styl"
2+
@require "./mixin.styl"
23

34
body, html
45
line-height: 1
@@ -52,6 +53,9 @@ body, html
5253
height: 100%
5354
transform-origin: left 0
5455

56+
.cube-safe-area-pb
57+
safe-area-mixin(padding-bottom, bottom, true)
58+
5559
@media (min-resolution: 2dppx)
5660
.border-top-1px
5761
&::before

src/common/stylus/mixin.styl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,10 @@ bg-image($url, $ext = ".png")
5454
background-image: url($url + "@2x" + $ext)
5555
@media (min-resolution: 3dppx)
5656
background-image: url($url + "@3x" + $ext)
57+
58+
functions = constant env
59+
safe-area-fn(fn, position)
60+
s("%s(safe-area-inset-%s)", fn, position)
61+
safe-area-mixin(property, position, important = false)
62+
for fn in functions
63+
{property} safe-area-fn(fn, position) important == true ? !important : unquote("")

src/common/stylus/theme/default.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ $action-sheet-active-color := $color-orange
66
$action-sheet-bgc := $color-white
77
$action-sheet-active-bgc := $color-light-grey-opacity
88
$action-sheet-title-color := $color-dark-grey
9+
$action-sheet-space-bgc := $color-mask-bg
910
/// picker style
1011
$action-sheet-picker-cancel-color := $color-light-grey
1112
$action-sheet-picker-cancel-active-color := $color-light-grey-s

src/components/action-sheet/action-sheet.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@touchmove.prevent="noop"
1010
@click="cancel">
1111
<transition name="cube-action-sheet-move">
12-
<div class="cube-action-sheet-panel" v-show="isVisible" @click.stop="noop">
12+
<div class="cube-action-sheet-panel cube-safe-area-pb" v-show="isVisible" @click.stop="noop">
1313
<h1 class="cube-action-sheet-title border-bottom-1px" v-show="pickerStyle || title">{{title}}</h1>
1414
<div class="cube-action-sheet-content">
1515
<ul class="cube-action-sheet-list">
@@ -94,6 +94,7 @@
9494
.cube-action-sheet-panel
9595
text-align: center
9696
font-size: $fontsize-medium
97+
background-color: $action-sheet-bgc
9798
.cube-action-sheet-move-enter, .cube-action-sheet-move-leave-active
9899
transform: translate3d(0, 100%, 0)
99100
.cube-action-sheet-move-enter-active, .cube-action-sheet-move-leave-active
@@ -142,6 +143,7 @@
142143
143144
.cube-action-sheet-space
144145
height: 6px
146+
background-color: $action-sheet-space-bgc
145147
146148
.cube-action-sheet-item_active
147149
color: $action-sheet-active-color

src/components/picker/picker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@touchmove.prevent
99
@mask-click="cancel">
1010
<transition name="cube-picker-move">
11-
<div class="cube-picker-panel" v-show="isVisible" @click.stop>
11+
<div class="cube-picker-panel cube-safe-area-pb" v-show="isVisible" @click.stop>
1212
<div class="cube-picker-choose border-bottom-1px">
1313
<span data-action="cancel" @click="cancel">{{cancelTxt}}</span>
1414
<span data-action="confirm" @click="confirm">{{confirmTxt}}</span>

0 commit comments

Comments
 (0)