小程序初始提交
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<view
|
||||
class="cl-safe-area"
|
||||
:class="[pt.className]"
|
||||
:style="{
|
||||
height
|
||||
}"
|
||||
>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getSafeAreaHeight, parsePt } from "@/cool";
|
||||
import { computed, type PropType } from "vue";
|
||||
|
||||
defineOptions({
|
||||
name: "cl-safe-area"
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
pt: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
type: {
|
||||
type: String as PropType<"top" | "bottom">,
|
||||
default: "top"
|
||||
},
|
||||
transparent: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
type PassThrough = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const pt = computed(() => parsePt<PassThrough>(props.pt));
|
||||
|
||||
// 高度
|
||||
const height = computed(() => {
|
||||
return getSafeAreaHeight(props.type) + "px";
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,10 @@
|
||||
export type ClSafeAreaPassThrough = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export type ClSafeAreaProps = {
|
||||
className?: string;
|
||||
pt?: ClSafeAreaPassThrough;
|
||||
type?: "top" | "bottom";
|
||||
transparent?: boolean;
|
||||
};
|
||||
Reference in New Issue
Block a user