本文編輯: 明日創意科技有限公司瀏覽 4790
版權所有,嚴禁轉載
頁面鏈接。
Tip:
效果圖:
wxml
<!-- 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 class="title"> {{title}} </view>
<view> 點擊左上角返回回到之前頁面 </view>
<!-- redirect.wxml -->
<view class="title"> {{title}} </view>
<view> 點擊左上角返回回到上級頁面 </view>
js
// redirect.js navigator.js
Page({
onLoad: function(options) {
this.setData({
title: options.title
})
}
}
wxss
/** wxss **/
/** 修改默認的navigator點擊態 **/
.navigator-hover {
color:blue;
}
/** 自定義其他點擊態樣式類 **/
.other-navigator-hover {
color:red;
}
.title{
text-align:center;
}
屬性名 | 類型 | 默認值 | 說明 |
---|---|---|---|
url | String | 應用內的跳轉鏈接 | |
redirect | Boolean | false | 是否關閉當前頁面 |
hover-class | String | navigator-hover | 指定點擊時的樣式類,當hover-class=”none”時,沒有點擊態效果 |