微信小程序顶部导航栏超链接
时间: 2023-09-03 11:15:05 浏览: 105
微信小程序顶部导航栏可以通过设置 `navigator` 组件来实现超链接跳转。具体步骤如下:
1. 在使用 `navigator` 的页面的 `json` 文件中引入 `navigator` 组件
```json
{
"usingComponents": {
"navigator": "/path/to/navigator"
}
}
```
2. 在页面的 `wxml` 文件中添加 `navigator` 组件,并设置 `url` 属性为跳转链接
```html
<navigator url="/pages/other-page/other-page">跳转到其他页面</navigator>
```
3. 可以通过设置 `open-type` 属性来控制打开方式,如在当前页面打开或在新页面打开等。
```html
<navigator url="/pages/other-page/other-page" open-type="navigate">在新页面打开</navigator>
<navigator url="/pages/other-page/other-page" open-type="redirect">在当前页面打开</navigator>
```
注意:被跳转的页面必须在 app.json 中进行注册。
阅读全文
相关推荐















