当前位置:网站首页>微信小程序,获取当前页面,判断当前页面是不是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) {
}
}
});
}
}边栏推荐
- c语言---12 分支语句switch
- pwnable start
- C language -- 14 loop statement for
- 踩坑了,BigDecimal 使用不当,造成P0事故!
- mysql备份和shell脚本手动执行没问题,crontab定时执行失败
- 基于智慧路灯杆打造智慧社区物联网
- 改变世界的开发者丨玩转“俄罗斯方块”的瑶光少年
- AOV网拓扑排序
- Summary of all contents of cloud computing setup to ensure that a complete cloud computing server can be built, including node installation, instance allocation, network configuration, etc
- Abbexa CDAN1 siRNA使用说明书
猜你喜欢

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

Abbexa 1,3-二棕榈素 CLIA 试剂盒解决方案

AI 加持实时互动|ZegoAvatar 面部表情随动技术解析

Linear mobile chess

muduo源码剖析——以三个切片浅析muduo库代码设计的严谨性、高效性与灵活性

Postman interface test tool

安装Linux系统的MySQL,在xshell中遇见的问题

Classic topics of leetcode tree (I)

Adding rendererdata of URP with script

干货 | 一文搞定 uiautomator2 自动化测试工具使用
随机推荐
YML file configuration parameter definition dictionary and list
堆利用之chunk extend: HITCON tranining lab13
Data URL
线性移动棋
LoRa模块无线收发通信技术详解
自定义类型:结构体
Abbexa低样本量鸡溶菌酶 C (LYZ) ELISA 试剂盒
期货网上开户安全吗,具体怎么开户的
踩坑了,BigDecimal 使用不当,造成P0事故!
Win7系统下无法正常安装JLINK CDC UART驱动的问题解决
基础提升---树形DP补充
AGI基础,不确定性推理,主观逻辑一书ppt1
Cdga| six key points of data governance for industrial enterprises
AGI基础,不确定性推理,主观逻辑一书ppt2
LeetCode 321. Maximum number of splices***
搭建在线帮助中心,轻松帮助客户解决问题
[technical analysis] discuss the production process and technology of big world games - preliminary process
[FAQ] summary of common problems and solutions during the use of rest API interface of sports health service
XML & XPath parsing
关于目前CIM(BIM+GIS)行业的一些看法