dcloudio / dcloudio/uni-app

h5顶部导航栏功能与微信小程序对齐

Open
#5,629 0 comments 0 reactions 0 assignees View on GitHub
h5
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

### 发行方式

H5

### 具体平台

h5

### 开发环境

None

### 项目创建方式

None

### 依赖版本

3.0.0-4030620241128001

### 问题描述

目前h5的顶部导航栏的按钮行为是如果栈里只有一条数据,且导航方式为`redirectTo`或`reLaunch`时不显示返回按钮,而微信小程序中除非手动隐藏,否则会显示回到首页的按钮。这一块能否和小程序的功能对齐?

### 重现步骤

```js
if (__UNI_FEATURE_PAGES__ && history.state) {
const type = history.state.__type__;
if ((type === "redirectTo" || type === "reLaunch") && getCurrentPages().length === 0) {
pageMeta.isEntry = true;
pageMeta.isQuit = true;
}
}
```

```js
function createBackButtonTsx(navigationBar, isQuit) {
if (!isQuit) {
return createVNode("div", {
"class": "uni-page-head-btn",
"onClick": onPageHeadBackButton
}, [createSvgIconVNode(ICON_PATH_BACK, navigationBar.type === "transparent" ? "#fff" : navigationBar.titleColor, 26)], 8, ["onClick"]);
}
}
```

### 期望行为

_No response_

### 实际行为

_No response_

### 截图或录屏

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.