Skip to content

Feat web title bar#2530

Open
mackwang112 wants to merge 4 commits into
masterfrom
feat-web-title-bar-mackwang
Open

Feat web title bar#2530
mackwang112 wants to merge 4 commits into
masterfrom
feat-web-title-bar-mackwang

Conversation

@mackwang112

Copy link
Copy Markdown
Collaborator

支持web下的titlebar,模拟微信原生titlebar效果,适用于不存在地址栏的webview容器中使用,需在运行时通过设置mpx.config.webConfig.enableTitleBar = true开启改效果

采用内建组件实现方式,新增mpx-titlebar组件作为所有页面根容器

@mackwang112 mackwang112 changed the title Feat web title bar mackwang Feat web title bar Jun 24, 2026
if (ctorType === 'page') {
if (isWeb(mode)) {
return createASTElement('page')
const rootView = createASTElement('titlebar', [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应再这个位置处理注入,且不应该修改page标签,会破坏page选择器表现

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以修改到processTemplate 中按页面插入,保留page标签

mackwang112 and others added 2 commits July 1, 2026 18:13
- 移除 compiler.js 中 page+web 模式下插入 titlebar AST 节点的逻辑,还原为 createASTElement('page')
- 删除 platform/template/wx/component-config/titlebar.js 及其注册
- 移除 dom-tag-config.js 中 mpx-titlebar 的 isBuildInWebTag 注册
- processTemplate.js 中对 page 类型按编译期 navigationStyle 判断插入 mpx-titlebar,注册为 builtInComponent 而非全局组件
- processJSON.js 处理 app 时写入 mpx.appJson 供编译期复用
- mpx-titlebar.vue:简化 props(移除 windowConfig,pageConfig 接收已合并配置)、移除冗余 cfg computed、navigator.userAgent 移至 computed 避免 SSR 崩溃、删除 console.log

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
新方案不对外暴露 titlebar 标签供用户调用,不需要在 isNativeMiniTag 中注册

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants