#### navigator
頁面鏈接。
| 屬性名 | 類型 | 默認值 | 說明 | 最低版本 |
| ---------------------- | ------- | --------------- | ---------------------------------------- | ---------------------------------------- |
| url | String | | 應用內的跳轉鏈接 | |
| open-type | String | navigate | 跳轉方式 | |
| delta | Number | | 當 open-type 為 'navigateBack' 時有效,表示回退的層數 | |
| hover-class | String | navigator-hover | 指定點擊時的樣式類,當`hover-class="none"`時,沒有點擊態效果 | |
| hover-stop-propagation | Boolean | false | 指定是否阻止本節點的祖先節點出現點擊態 | [1.5.0](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/compatibility.html) |
| hover-start-time | Number | 50 | 按住后多久出現點擊態,單位毫秒 | |
| hover-stay-time | Number | 600 | 手指松開后點擊態保留時間,單位毫秒 | |
**open-type 有效值:**
| 值 | 說明 | 最低版本 |
| ------------ | ------------------------ | ---------------------------------------- |
| navigate | 對應 `wx.navigateTo` 的功能 | |
| redirect | 對應 `wx.redirectTo` 的功能 | |
| switchTab | 對應 `wx.switchTab` 的功能 | |
| reLaunch | 對應 `wx.reLaunch` 的功能 | [1.1.0](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/compatibility.html) |
| navigateBack | 對應 `wx.navigateBack` 的功能 | [1.1.0](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/compatibility.html) |
**注:navigator-hover 默認為 {background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, <navigator/> 的子節點背景色應為透明色**
**示例代碼:**
```
/** wxss **/
/** 修改默認的navigator點擊態 **/
.navigator-hover {
color:blue;
}
/** 自定義其他點擊態樣式類 **/
.other-navigator-hover {
color:red;
}
```
```
<!-- sample.wxml -->
<view class="btn-area">
<navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳轉到新頁面</navigator>
<navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在當前頁打開</navigator>
<navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切換 Tab</navigator>
</view>
```
```
<!-- navigator.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 點擊左上角返回回到之前頁面 </view>
<!-- redirect.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 點擊左上角返回回到上級頁面 </view>
// redirect.js navigator.js
Page({
onLoad: function(options) {
this.setData({
title: options.title
})
}
})
```
- 簡介
- 第一章 公眾號開發
- 使用微信JSSDK
- 接口權限配置
- 分享接口
- 隱藏按鈕項
- 微信支付
- 第二章 小程序開發
- 基礎知識
- 分包加載
- WXSS樣式表
- 配置
- app.json配置
- window
- tabBar
- page.json配置
- 邏輯層
- app.js
- 場景值
- page.js
- 初始化數據
- 生命周期函數
- 頁面相關事件處理函數
- 事件處理函數
- 頁面實例方法
- 路由
- 文件作用域
- 模塊化
- 視圖層
- 模板語法
- 列表渲染
- 條件渲染
- 模板
- 事件
- 引用
- WXS語法規范
- WXS數據類型
- WXS控制流程
- WXS基礎類庫
- 組件
- 視圖容器
- view
- scroll-view
- swiper
- movable-view
- cover-view
- 基礎組件
- icon
- text
- rich-text
- progress
- 表單組件
- button
- checkbox
- form
- input
- label
- picker
- picker-view
- radio
- slider
- switch
- textarea
- 導航組件
- navigator
- 媒體組件
- audio
- image
- video
- camera
- 地圖組件
- map
- 畫布組件
- canvas
- 開放能力
- web-view
- 自定義組件
- 組件模版和樣式
- Component
- 組件傳值
- 組件事件
- Behaviors
- 組件間關系
- 網絡請求
- wx.request
- 微信登錄
- 獲取 openid 和 unionid
- 獲取用戶信息
- 將 wx.request 封裝為 promise
- 上傳圖片接口封裝
- 數據存儲
- 存儲數據和讀取數據
- 獲取數據緩存信息
- 移除數據緩存
- 獲取用戶設置
- openSetting
- getSetting
- 第三章 小游戲開發
- 參考資料