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 @@ - +