導航navigator:官方文檔html
Demo Code:xss
// redirect.js navigator.js Page({ onLoad: function(options) { this.setData({ title: options.title }) } })
<!-- sample.wxml --> <view class="btn-area"> <navigator url="navigate?title=navigate" hover-class="navigator-hover">跳轉到新頁面</navigator> <navigator url="redirect?title=redirect" redirect hover-class="other-navigator-hover">在當前頁打開</navigator> </view> <!-- navigator.wxml --> <view style="text-align:center"> {{title}} </view> <view> 點擊左上角返回回到以前頁面 </view> <!-- redirect.wxml --> <view style="text-align:center"> {{title}} </view> <view> 點擊左上角返回回到上級頁面 </view>
/** wxss **/ /** 修改默認的navigator點擊態 **/ .navigator-hover { color:blue; } /** 自定義其餘點擊態樣式類 **/ .other-navigator-hover { color:red; }