微信小程序之入門篇(一)
微信小程序之注冊篇(二)
微信小程序之開發(fā)初體驗(yàn)(三)——開發(fā)工具使用和目錄結(jié)構(gòu)
微信小程序之生命周期(四)
微信小程序之?dāng)?shù)據(jù)綁定(五)
微信小程序之觸控事件(六)
微信小程序之基礎(chǔ)組件篇——視圖容器(七)
微信小程序之基礎(chǔ)組件篇——基礎(chǔ)內(nèi)容(八)
微信小程序之基礎(chǔ)組件篇——表單組件(九)
微信小程序之基礎(chǔ)組件篇——導(dǎo)航組件(十)
微信小程序之基礎(chǔ)組件篇——媒體組件(十一)
微信小程序之API篇——豆瓣圖書搜索(十二)
微信小程序之拓展篇——weui-wxss(十三)
本篇文章將介紹小程序的基礎(chǔ)組件——導(dǎo)航組件。
導(dǎo)航組件只有一個(gè)組件:
- navigator
navigator

/** 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="navigate?title=navigate" hover-class="navigator-hover">跳轉(zhuǎn)到新頁面</navigator>
<navigator url="redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在當(dāng)前頁打開</navigator>
<navigator url="index" open-type="switchTab" hover-class="other-navigator-hover">切換 Tab</navigator>
</view>
<!-- navigator.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 點(diǎn)擊左上角返回回到之前頁面 </view>
<!-- redirect.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 點(diǎn)擊左上角返回回到上級頁面 </view>
// redirect.js和navigator.js均為
Page({
onLoad: function(options) {
this.setData({
title: options.title
})
}
})