diff --git a/packages/uni-h5/src/framework/components/layout/index.tsx b/packages/uni-h5/src/framework/components/layout/index.tsx index 92795ca269a90cb53cadb4bb6abbdab551f15615..0f11187e3aa434433b87c7be22e49ee966978a96 100644 --- a/packages/uni-h5/src/framework/components/layout/index.tsx +++ b/packages/uni-h5/src/framework/components/layout/index.tsx @@ -24,7 +24,11 @@ import { defineSystemComponent } from '@dcloudio/uni-components' import { updateCssVar } from '@dcloudio/uni-core' import { useTabBar } from '../../setup/state' import { useKeepAliveRoute } from '../../setup/page' -import { resolveOwnerEl, RESPONSIVE_MIN_WIDTH } from '@dcloudio/uni-shared' +import { + resolveOwnerEl, + RESPONSIVE_MIN_WIDTH, + ON_NAVIGATION_BAR_CHANGE, +} from '@dcloudio/uni-shared' import { checkMinWidth } from '../../../helpers/dom' import { hasOwn } from '@vue/shared' @@ -111,6 +115,7 @@ interface LayoutState { marginWidth: number leftWindowWidth: number rightWindowWidth: number + navigationBarTitleText: string topWindowStyle: unknown leftWindowStyle: unknown rightWindowStyle: unknown @@ -235,6 +240,7 @@ function useState() { marginWidth: 0, leftWindowWidth: 0, rightWindowWidth: 0, + navigationBarTitleText: '', topWindowStyle: {}, leftWindowStyle: {}, rightWindowStyle: {}, @@ -276,6 +282,9 @@ function useState() { () => layoutState.rightWindowWidth + layoutState.marginWidth, (value) => updateCssVar({ '--window-right': value + 'px' }) ) + UniServiceJSBridge.on(ON_NAVIGATION_BAR_CHANGE, (navigationBar) => { + layoutState.navigationBarTitleText = navigationBar.titleText + }) const windowState = computed(() => ({ matchTopWindow: layoutState.topWindowMediaQuery, showTopWindow: layoutState.showTopWindow || layoutState.apiShowTopWindow, @@ -460,7 +469,11 @@ function createTopWindowTsx( v-show={layoutState.showTopWindow || layoutState.apiShowTopWindow} >
- +