注冊(cè)

微信小程序?qū)Ш絥avigator,navigator頁(yè)面鏈接

2017-12-22
導(dǎo)讀:navigator 頁(yè)面鏈接。 屬性名 類型 默認(rèn)值 說(shuō)明 url String 應(yīng)用內(nèi)的跳轉(zhuǎn)鏈接 open-type String navigate 跳轉(zhuǎn)方式 delta Number 當(dāng) open-type 為 'navigateBack' 時(shí)有效,表示回退的層數(shù) hover-class String naviga...

頁(yè)面鏈接。

 

屬性名 類型 默認(rèn)值 說(shuō)明
url String   應(yīng)用內(nèi)的跳轉(zhuǎn)鏈接
open-type String navigate 跳轉(zhuǎn)方式
delta Number   當(dāng) open-type 為 'navigateBack' 時(shí)有效,表示回退的層數(shù)
hover-class String navigator-hover 指定點(diǎn)擊時(shí)的樣式類,當(dāng)hover-class="none"時(shí),沒(méi)有點(diǎn)擊態(tài)效果
hover-start-time Number 50 按住后多久出現(xiàn)點(diǎn)擊態(tài),單位毫秒
hover-stay-time Number 600 手指松開(kāi)后點(diǎn)擊態(tài)保留時(shí)間,單位毫秒

open-type 有效值:

說(shuō)明 最低版本
navigate 對(duì)應(yīng)wx.navigateTo的功能  
redirect 對(duì)應(yīng)wx.redirectTo的功能  
switchTab 對(duì)應(yīng)wx.switchTab的功能  
reLaunch 對(duì)應(yīng)wx.reLaunch的功能 1.1.0
navigateBack 對(duì)應(yīng)wx.navigateBack的功能 1.1.0

注:navigator-hover默認(rèn)為{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, <navigator/>的子節(jié)點(diǎn)背景色應(yīng)為透明色

示例代碼:

/** wxss **/
/** 修改默認(rèn)的navigator點(diǎn)擊態(tài) **/
.navigator-hover {
    color:blue;
}
/** 自定義其他點(diǎn)擊態(tài)樣式類 **/
.other-navigator-hover {
    color:red;
}
<!-- sample.wxml -->
<view class="btn-area">
  <navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳轉(zhuǎn)到新頁(yè)面</navigator>
  <navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在當(dāng)前頁(yè)打開(kāi)</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> 點(diǎn)擊左上角返回回到之前頁(yè)面 </view>
<!-- redirect.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 點(diǎn)擊左上角返回回到上級(jí)頁(yè)面 </view>
// redirect.js navigator.js
Page({
  onLoad: function(options) {
    this.setData({
      title: options.title
    })
  }
})
更多微信小程序開(kāi)發(fā)教程,可以關(guān)注hi小程序。
重磅推薦:小程序開(kāi)店目錄

第一部分:小商店是什么

第二部分:如何開(kāi)通一個(gè)小商店

第三部分:如何登錄小商店

第四部分:開(kāi)店任務(wù)常見(jiàn)問(wèn)題

第五部分:小商店可以賣什么

第六部分:HiShop小程序特色功能

第七部分:小程序直播

第八部分:小程序收貨/物流

第九部分:小程序怎么結(jié)算

第十部分:小程序客服

第十一部分:電商創(chuàng)業(yè)

第十二部分:小程序游戲開(kāi)發(fā)