微信小程序 wxapp導(dǎo)航 navigator詳解
更新時間:2016年10月31日 15:16:07 投稿:lqh
這篇文章主要介紹了微信小程序 wxapp導(dǎo)航 navigator詳解的相關(guān)資料,并附簡單實例代碼,需要的朋友可以參考下
微信小程序 wxapp導(dǎo)航 navigator
最近微信小程序非?;?,朋友圈,微博,論壇等地方都在刷屏,因為這是搞前端的春天,前端工程師可以賺一把了,所以業(yè)余就學(xué)習(xí)了微信小程序的知識,這里記錄下 :
navigator
| 屬性名 | 類型 | 默認(rèn)值 | 說明 |
|---|---|---|---|
| url | String | 應(yīng)用內(nèi)的跳轉(zhuǎn)鏈接 | |
| redirect | Boolean | false | 是否關(guān)閉當(dāng)前頁面 |
| hover-class | String | navigator-hover | 指定點擊時的樣式類,當(dāng)hover-class="none"時,沒有點擊態(tài)效果 |
注:navigator-hover默認(rèn)為{background-color:rgba(0,0,0,0.1);opacity:0.7;},<navigator/>的子節(jié)點背景色應(yīng)為透明色
示例代碼:
/** wxss **/
/** 修改默認(rèn)的navigator點擊態(tài) **/
.navigator-hover{
color:blue;
}
/** 自定義其他點擊態(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" redirect hover-class="other-navigator-hover">在當(dāng)前頁打開</navigator> </view> </navigator>
<!-- 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
})
}
})
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
JS創(chuàng)建對象常用設(shè)計模式工廠構(gòu)造函數(shù)及原型
本篇帶來你一定熟知的、用于創(chuàng)建對象的三種設(shè)計模式:工廠模式、構(gòu)造函數(shù)模式、原型模式,有需要的朋友可以借鑒參考下,希望能夠有所幫助2022-07-07
PHP:微信小程序 微信支付服務(wù)端集成實例詳解及源碼下載
這篇文章主要介紹了微信小程序 微信支付服務(wù)端集成實例詳解及源碼下載的相關(guān)資料,需要的朋友可以參考下2017-01-01

