日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

a标签跳转后关闭当前页面_微信小程序2020-day-2 导航项目(跳转三种形态)

發(fā)布時(shí)間:2023/12/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 a标签跳转后关闭当前页面_微信小程序2020-day-2 导航项目(跳转三种形态) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

day-2 導(dǎo)航項(xiàng)目(跳轉(zhuǎn)三種形態(tài))

轉(zhuǎn)發(fā)跳轉(zhuǎn):保留當(dāng)前頁(yè)面,跳轉(zhuǎn)新頁(yè)面,可返回

重定向跳轉(zhuǎn):關(guān)閉當(dāng)前頁(yè)面,跳轉(zhuǎn),不可返回,不能指定標(biāo)簽導(dǎo)航頁(yè)面

跳轉(zhuǎn)標(biāo)簽導(dǎo)航:跳轉(zhuǎn)到標(biāo)簽導(dǎo)航頁(yè)面,標(biāo)簽導(dǎo)航跟隨選中

app.json

{"pages":["pages/home/home","pages/navigator/navigator","pages/redirect/redirect"],"window":{"backgroundTextStyle":"light","navigationBarBackgroundColor": "#2ba008","navigationBarTitleText": "導(dǎo)航三種跳轉(zhuǎn)","navigationBarTextStyle":"white"},"tabBar": {"selectedColor": "#FFF","backgroundColor": "#2ba008","color": "#FFF","list": [{"pagePath": "pages/home/home","text": "首頁(yè)"},{"pagePath": "pages/redirect/redirect","text": "關(guān)閉頁(yè)面跳轉(zhuǎn)"}]},"style": "v2","sitemapLocation": "sitemap.json" }

app.wxss

/**app.wxss**/.content {width: 100%;height: 100%;display: flex;flex-direction: column;align-items: center;box-sizing: border-box;font-family: Arial, Helvetica, sans-serif; }

home.wxml

<!--pages/home/home.wxml--><view class="btn-area"><!-- 保留頁(yè)面跳轉(zhuǎn) --><navigator url="../navigator/navigator?title=Navigator" open-type="navigate" hover-class="navigator-hover">保留頁(yè)面跳轉(zhuǎn)</navigator><text>wx.navigateTo()</text><button type="primary" bindtap="navigateBtn" style="width:100%;">保留頁(yè)面跳轉(zhuǎn)</button><!-- 關(guān)閉頁(yè)面跳轉(zhuǎn) --><navigator url="../navigator/navigator?title=Redirect" open-type="redirect" hover-class="other-navigator-hover">關(guān)閉頁(yè)面跳轉(zhuǎn)</navigator><text>wx.redirectTo()</text><button type="primary" bindtap="redirectBtn" style="width:100%;">關(guān)閉頁(yè)面跳轉(zhuǎn)</button><!-- 關(guān)閉頁(yè)面跳轉(zhuǎn) --><navigator url="../redirect/redirect?title=Switch" open-type="switchTab" hover-class="other-navigator-hover">標(biāo)簽導(dǎo)航頁(yè)面跳轉(zhuǎn)</navigator><text>wx.switchTo()</text><button type="primary" bindtap="switchBtn" style="width:100%;">標(biāo)簽導(dǎo)航頁(yè)面跳轉(zhuǎn)</button></view>

home.wxss

/* pages/home/home.wxss */.btn-area{display: flex;flex-direction: column;align-items: center;width: 100%; }navigator{width: 100%;height: 100rpx;background: honeydew;text-align: center;line-height: 100rpx; }text{width: 100%;height: 100rpx;background: cadetblue;text-align: center;line-height: 100rpx;color: white; }button{margin-bottom: 30rpx; }.navigator-hover{color: blue; }.other-navigator-hover{color: red; }

homs.js

// pages/home/home.js Page({/*** 頁(yè)面的初始數(shù)據(jù)*/data: {},/*** 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載*/onLoad: function (options) {},navigateBtn:function(){wx.navigateTo({url: '../navigator/navigator?title=NavigatorTo',success:function(res){console.log(res);},fail:function() {},complete:function() {}});},redirectBtn:function(){wx.redirectTo({url: '../navigator/navigator?title=RedirectTo',success:function(res){console.log(res);},fail:function() {},complete:function() {}});},switchBtn:function(){wx.switchTab({url: '../redirect/redirect?title=SwitchTab',success:function(res){console.log(res);},fail:function() {},complete:function() {}});} })

redirect.wxml

<!--pages/redirect/redirect.wxml--> <text>pages/redirect/redirect.wxml</text> <text>關(guān)閉當(dāng)前頁(yè)面,單機(jī)左上角的可以跳轉(zhuǎn)HOME</text>

navigator.wxml

<!--pages/navigator/navigator.wxml--> <text>pages/navigator/navigator.wxml</text> <text>保留當(dāng)前頁(yè)面,單機(jī)左上角的可以返回</text> <button type="primary" bindtap="backBtn">返回上一頁(yè)</button>

navigator.js

// pages/navigator/navigator.js Page({/*** 頁(yè)面的初始數(shù)據(jù)*/data: {},/*** 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載*/onLoad: function (options) {// options 獲取提交的數(shù)據(jù)var title = options.title;console.log(title);// 設(shè)置當(dāng)前頁(yè)面的導(dǎo)航標(biāo)題wx.setNavigationBarTitle({title: title,});// 設(shè)置導(dǎo)航的加載動(dòng)畫(huà)wx.showNavigationBarLoading();},backBtn:function(){// getCurrentPages() 獲取當(dāng)前頁(yè)面棧// 1 首頁(yè)wx.navigateBack({delta: 1,});} })

項(xiàng)目截圖

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的a标签跳转后关闭当前页面_微信小程序2020-day-2 导航项目(跳转三种形态)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。