From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 11:46:57 +0800 Subject: [PATCH] 项目初始化 --- uni_modules/uview-ui/components/u-safe-bottom/u-safe-bottom.vue | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-safe-bottom/u-safe-bottom.vue b/uni_modules/uview-ui/components/u-safe-bottom/u-safe-bottom.vue new file mode 100644 index 0000000..fb858ea --- /dev/null +++ b/uni_modules/uview-ui/components/u-safe-bottom/u-safe-bottom.vue @@ -0,0 +1,56 @@ +<template> + <view + class="u-safe-bottom" + :style="[style]" + :class="[!isNvue && 'u-safe-area-inset-bottom']" + > + </view> +</template> + +<script> + import props from "./props.js"; + /** + * SafeBottom 搴曢儴瀹夊叏鍖� + * @description 杩欎釜閫傞厤锛屼富瑕佹槸閽堝IPhone X绛変竴浜涘簳閮ㄥ甫鎸囩ず鏉$殑鏈哄瀷锛屾寚绀烘潯鐨勬搷浣滃尯鍩熶笌椤甸潰搴曢儴瀛樺湪閲嶅悎锛屽鏄撳鑷寸敤鎴疯鎿嶄綔锛屽洜姝ゆ垜浠渶瑕侀拡瀵硅繖浜涙満鍨嬭繘琛屽簳閮ㄥ畨鍏ㄥ尯閫傞厤銆� + * @tutorial https://www.uviewui.com/components/safeAreaInset.html + * @property {type} prop_name + * @property {Object} customStyle 瀹氫箟闇�瑕佺敤鍒扮殑澶栭儴鏍峰紡 + * + * @event {Function()} + * @example <u-status-bar></u-status-bar> + */ + export default { + name: "u-safe-bottom", + mixins: [uni.$u.mpMixin, uni.$u.mixin, props], + data() { + return { + safeAreaBottomHeight: 0, + isNvue: false, + }; + }, + computed: { + style() { + const style = {}; + // #ifdef APP-NVUE + // nvue涓嬶紝楂樺害浣跨敤js璁$畻濉厖 + style.height = uni.$u.addUnit(uni.$u.sys().safeAreaInsets.bottom, 'px'); + // #endif + return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)); + }, + }, + mounted() { + // #ifdef APP-NVUE + // 鏍囪瘑涓烘槸鍚vue + this.isNvue = true; + // #endif + }, + }; +</script> + +<style lang="scss" scoped> + .u-safe-bottom { + /* #ifndef APP-NVUE */ + width: 100%; + /* #endif */ + } +</style> -- Gitblit v1.9.3