当前位置:网站首页>微信小程序,获取当前页面,判断当前页面是不是tabbar页面
微信小程序,获取当前页面,判断当前页面是不是tabbar页面
2022-06-10 17:51:00 【坐等夕阳落time】
原理:用getCurrentPages()方法,获取用户访问的所有页面,最后的那个页面就是当前页

然后有route属性,就知道当前页面的路径了,再和tabbar页面的路径对比就好了
let pages = getCurrentPages()
console.log(pages)
if(pages.length > 0) {
let prevPage = pages[pages.length - 1]
if (prevPage.route === 'pages/index/index' || prevPage.route === 'pages/chat/chat') {
uni.showModal({
title: '提示',
content: '这是tabbar页面',
showCancel: false,
success: (res) => {
if(res.confirm) {
}
}
});
}
}边栏推荐
猜你喜欢

Domestic cosmetics, lost 618

Abbexa 8-OHdG CLIA 试剂盒解决方案

Red vertical left side menu navigation code

c语言---3 初识变量

一文带你了解J.U.C的FutureTask、Fork/Join框架和BlockingQueue

Step on the pit. The BigDecimal was improperly used, resulting in P0 accident!

The development of flutter in digital life and the landing practice of Tianyi cloud disk

JS special effect of canvas divergent particle H5 animation

Adding rendererdata of URP with script

三部曲解下棋先手后手问题
随机推荐
Talk about those things about telecommuting, participate in the essay solicitation, receive the contribution fee and win the grand prize!
How to locate the hot problem of the game
安装Linux系统的MySQL,在xshell中遇见的问题
图像搜索是什么
套路解---马走棋盘问题
滑动窗口最值问题
Abbexa 1,3-二棕榈素 CLIA 试剂盒解决方案
c语言---4 初识常量
期货网上开户安全吗,具体怎么开户的
QTableWidget / QTableView实用技巧
AD18器件库导入简介
三部曲套路解bob活命问题
基于注解和反射生成xml
Container containing the most water
Abbexa 8-OHdG CLIA 试剂盒解决方案
[FAQ] summary of common problems and solutions during the use of rest API interface of sports health service
Qtablewidget / qtableview practical tips
AGI基础,不确定性推理,主观逻辑一书ppt1
XML & XPath parsing
将同一文件夹下的大量文件根据设定分至多组