Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
7efd1e5c
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7efd1e5c
编写于
8月 08, 2022
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): onNavigationBarChange layout navigationBarTitleText
上级
dea87d13
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
4 deletion
+24
-4
packages/uni-h5/src/framework/components/layout/index.tsx
packages/uni-h5/src/framework/components/layout/index.tsx
+15
-2
packages/uni-h5/src/helpers/useDocumentTitle.ts
packages/uni-h5/src/helpers/useDocumentTitle.ts
+2
-1
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+2
-0
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+2
-0
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+2
-1
packages/uni-shared/src/constants.ts
packages/uni-shared/src/constants.ts
+1
-0
未找到文件。
packages/uni-h5/src/framework/components/layout/index.tsx
浏览文件 @
7efd1e5c
...
...
@@ -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
<
WindowState
>
(()
=>
({
matchTopWindow
:
layoutState
.
topWindowMediaQuery
,
showTopWindow
:
layoutState
.
showTopWindow
||
layoutState
.
apiShowTopWindow
,
...
...
@@ -460,7 +469,11 @@ function createTopWindowTsx(
v
-
show
=
{
layoutState
.
showTopWindow
||
layoutState
.
apiShowTopWindow
}
>
<
div
class
=
"uni-top-window"
style
=
{
layoutState
.
topWindowStyle
as
any
}
>
<
TopWindow
ref
=
{
windowRef
}
{
...
windowState
}
/>
<
TopWindow
ref
=
{
windowRef
}
navigation
-
bar
-
title
-
text
=
{
layoutState
.
navigationBarTitleText
}
{
...
windowState
}
/>
</
div
>
<
div
class
=
"uni-top-window--placeholder"
...
...
packages/uni-h5/src/helpers/useDocumentTitle.ts
浏览文件 @
7efd1e5c
import
{
watchEffect
,
onActivated
,
ssrContextKey
}
from
'
vue
'
import
{
UNI_SSR_TITLE
}
from
'
@dcloudio/uni-shared
'
import
{
UNI_SSR_TITLE
,
ON_NAVIGATION_BAR_CHANGE
}
from
'
@dcloudio/uni-shared
'
import
{
getApp
}
from
'
../framework/setup/app
'
export
function
updateDocumentTitle
(
title
:
string
)
{
...
...
@@ -12,6 +12,7 @@ export function updateDocumentTitle(title: string) {
}
else
{
document
.
title
=
title
}
UniServiceJSBridge
.
emit
(
ON_NAVIGATION_BAR_CHANGE
,
{
titleText
:
title
})
}
export
function
useDocumentTitle
(
pageMeta
:
UniApp
.
PageRouteMeta
)
{
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
7efd1e5c
...
...
@@ -248,6 +248,7 @@ const ON_ADD_TO_FAVORITES = 'onAddToFavorites';
const
ON_SHARE_APP_MESSAGE
=
'
onShareAppMessage
'
;
// navigationBar
const
ON_NAVIGATION_BAR_BUTTON_TAP
=
'
onNavigationBarButtonTap
'
;
const
ON_NAVIGATION_BAR_CHANGE
=
'
onNavigationBarChange
'
;
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
=
'
onNavigationBarSearchInputClicked
'
;
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
=
'
onNavigationBarSearchInputChanged
'
;
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
=
'
onNavigationBarSearchInputConfirmed
'
;
...
...
@@ -1472,6 +1473,7 @@ exports.ON_KEYBOARD_HEIGHT_CHANGE = ON_KEYBOARD_HEIGHT_CHANGE;
exports
.
ON_LAUNCH
=
ON_LAUNCH
;
exports
.
ON_LOAD
=
ON_LOAD
;
exports
.
ON_NAVIGATION_BAR_BUTTON_TAP
=
ON_NAVIGATION_BAR_BUTTON_TAP
;
exports
.
ON_NAVIGATION_BAR_CHANGE
=
ON_NAVIGATION_BAR_CHANGE
;
exports
.
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
=
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
;
exports
.
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
=
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
;
exports
.
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
=
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
7efd1e5c
...
...
@@ -454,6 +454,8 @@ export declare const ON_LOAD = "onLoad";
export
declare
const
ON_NAVIGATION_BAR_BUTTON_TAP
=
"
onNavigationBarButtonTap
"
;
export
declare
const
ON_NAVIGATION_BAR_CHANGE
=
"
onNavigationBarChange
"
;
export
declare
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
=
"
onNavigationBarSearchInputChanged
"
;
export
declare
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
=
"
onNavigationBarSearchInputClicked
"
;
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
7efd1e5c
...
...
@@ -244,6 +244,7 @@ const ON_ADD_TO_FAVORITES = 'onAddToFavorites';
const
ON_SHARE_APP_MESSAGE
=
'
onShareAppMessage
'
;
// navigationBar
const
ON_NAVIGATION_BAR_BUTTON_TAP
=
'
onNavigationBarButtonTap
'
;
const
ON_NAVIGATION_BAR_CHANGE
=
'
onNavigationBarChange
'
;
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
=
'
onNavigationBarSearchInputClicked
'
;
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
=
'
onNavigationBarSearchInputChanged
'
;
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
=
'
onNavigationBarSearchInputConfirmed
'
;
...
...
@@ -1415,4 +1416,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
BUILT_IN_TAG_NAMES
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
E$1
as
Emitter
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVUE_BUILT_IN_TAGS
,
NVUE_U_BUILT_IN_TAGS
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_INIT
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SAVE_EXIT_STATE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UNI_STORAGE_LOCALE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
customizeEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultNVueRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatH5Log
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDatasetOnce
,
invokeArrayFns
,
invokeCreateVueAppHook
,
isAppNVueNativeTag
,
isAppNativeTag
,
isBuiltInComponent
,
isComponentInternalInstance
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
isRootImmediateHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
onCreateVueApp
,
once
,
parseEventName
,
parseNVueDataset
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveComponentInstance
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
sortObject
,
stringifyQuery
,
updateElementStyle
};
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
BUILT_IN_TAG_NAMES
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
E$1
as
Emitter
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVUE_BUILT_IN_TAGS
,
NVUE_U_BUILT_IN_TAGS
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_INIT
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_
CHANGE
,
ON_NAVIGATION_BAR_
SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SAVE_EXIT_STATE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UNI_STORAGE_LOCALE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
customizeEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultNVueRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatH5Log
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDatasetOnce
,
invokeArrayFns
,
invokeCreateVueAppHook
,
isAppNVueNativeTag
,
isAppNativeTag
,
isBuiltInComponent
,
isComponentInternalInstance
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
isRootImmediateHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
onCreateVueApp
,
once
,
parseEventName
,
parseNVueDataset
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveComponentInstance
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
sortObject
,
stringifyQuery
,
updateElementStyle
};
packages/uni-shared/src/constants.ts
浏览文件 @
7efd1e5c
...
...
@@ -67,6 +67,7 @@ export const ON_ADD_TO_FAVORITES = 'onAddToFavorites'
export
const
ON_SHARE_APP_MESSAGE
=
'
onShareAppMessage
'
// navigationBar
export
const
ON_NAVIGATION_BAR_BUTTON_TAP
=
'
onNavigationBarButtonTap
'
export
const
ON_NAVIGATION_BAR_CHANGE
=
'
onNavigationBarChange
'
export
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
=
'
onNavigationBarSearchInputClicked
'
export
const
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录