-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
component.ts
37 lines (35 loc) · 904 Bytes
/
component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { defineComponent, h } from 'vue-demi'
import { useScreenSafeArea } from '.'
export const UseScreenSafeArea = /* #__PURE__ */ defineComponent({
name: 'UseScreenSafeArea',
props: {
top: Boolean,
right: Boolean,
bottom: Boolean,
left: Boolean,
},
setup(props, { slots }) {
const {
top,
right,
bottom,
left,
} = useScreenSafeArea()
return () => {
if (slots.default) {
return h('div', {
style: {
paddingTop: props.top ? top.value : '',
paddingRight: props.right ? right.value : '',
paddingBottom: props.bottom ? bottom.value : '',
paddingLeft: props.left ? left.value : '',
boxSizing: 'border-box',
maxHeight: '100vh',
maxWidth: '100vw',
overflow: 'auto',
},
}, slots.default())
}
}
},
})