From caf5803e4485e41b2702656390f824ca4df58a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E7=86=8A=E7=86=8A=E5=AD=90=E8=B7=AF?= Date: Mon, 9 Feb 2026 16:06:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20page-container=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=8C=E9=87=8D=E5=91=BD=E5=90=8D=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E7=9B=B8=E5=85=B3=E5=B1=9E=E6=80=A7=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=83=8C=E6=99=AF=E8=89=B2=E5=92=8C=E5=BA=95?= =?UTF-8?q?=E9=83=A8=E5=AE=89=E5=85=A8=E5=8C=BA=E9=80=82=E9=85=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../page-container/page-container.scss | 7 ++++ .../page-container/page-container.ts | 36 ++++++++++++------- .../page-container/page-container.wxml | 24 +++++++------ miniprogram/pages/date/date.wxml | 2 +- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/miniprogram/components/page-container/page-container.scss b/miniprogram/components/page-container/page-container.scss index d7e7fec..bf38d85 100644 --- a/miniprogram/components/page-container/page-container.scss +++ b/miniprogram/components/page-container/page-container.scss @@ -7,6 +7,13 @@ flex-direction: column; position: relative; box-sizing: border-box; + background-color: var(--pg-container-bg-color); + + // 预留安全区 + &--safe { + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + } } .page-container__content { diff --git a/miniprogram/components/page-container/page-container.ts b/miniprogram/components/page-container/page-container.ts index 1d00ec6..8c24071 100644 --- a/miniprogram/components/page-container/page-container.ts +++ b/miniprogram/components/page-container/page-container.ts @@ -6,60 +6,70 @@ Component({ */ properties: { // 导航栏标题 - title: { + navBarTitle: { type: String, value: '', }, // 是否显示返回按钮 - leftArrow: { + navBarLeftArrow: { type: Boolean, value: true, }, // 导航栏是否固定 - fixed: { + navBarFixed: { type: Boolean, value: true, }, // 导航栏占位 - placeholder: { + navBarPlaceholder: { type: Boolean, value: true, }, // 是否适配安全区域顶部 - safeAreaInsetTop: { + navBarSafeAreaInsetTop: { type: Boolean, value: true, }, // 导航栏层级 - zIndex: { + navBarZIndex: { type: Number, value: 10000, }, // 是否带动画效果 - animation: { + navBarAnimation: { type: Boolean, value: true, }, // 标题最大长度,超出用 "…" 表示 - titleMaxLength: { + navBarTitleMaxLength: { type: Number, value: undefined, }, // 是否显示导航栏 - visible: { + navBarVisible: { type: Boolean, value: true, }, // 导航栏背景色 - backgroundColor: { + navBarBackgroundColor: { type: String, value: '#ffffff', }, // 导航栏文本颜色(标题、返回按钮等) - textColor: { + navBarTextColor: { type: String, value: '#000000', }, + // 是否开启底部安全区适配 + containerSafeAreaInsetBottom: { + type: Boolean, + value: true, + }, + // pageContainer背景色 + containerBackgroundColor: { + type: String, + value: '#f5f5f5', + }, }, /** @@ -101,8 +111,8 @@ Component({ */ checkShowLeftArrow() { const pages = getCurrentPages() - const leftArrow = this.properties.leftArrow - const visible = this.properties.visible + const leftArrow = this.properties.navBarLeftArrow + const visible = this.properties.navBarVisible const showLeftArrow = pages.length > 1 && leftArrow && visible this.setData({ showLeftArrow, diff --git a/miniprogram/components/page-container/page-container.wxml b/miniprogram/components/page-container/page-container.wxml index 9cf748e..ccfe69f 100644 --- a/miniprogram/components/page-container/page-container.wxml +++ b/miniprogram/components/page-container/page-container.wxml @@ -1,22 +1,24 @@ - + diff --git a/miniprogram/pages/date/date.wxml b/miniprogram/pages/date/date.wxml index 494a129..6828241 100644 --- a/miniprogram/pages/date/date.wxml +++ b/miniprogram/pages/date/date.wxml @@ -1,5 +1,5 @@ - +