uniapp使用uv-popup弹出框隐藏底部导航tabbar方法

server/2025/2/7 14:36:47/

uniapp中使用uv-popup 弹出框隐藏底部导航tabbar

弹出层代码:

<text class="userlogin" @click="openPopup">请登录></text>
<!-- 弹出层 --><uv-popup ref="popupRef" mode="bottom" border-radius="10px 10px 0 0" background-color="#fff" zIndex="99"safeAreaInsetBottom="true"><view style="width: 600rpx; padding: 30rpx;"><text style="font-size: 32rpx; font-weight: bold;">登录提示</text><text style="font-size: 28rpx; color: #666; margin-top: 20rpx; display: block;">请登录后查看完整内容。</text><button style="background-color: #007AFF; color: #FFFFFF; padding: 20rpx; margin-top: 30rpx;">去登录</button></view></uv-popup>

逻辑代码:

<script lang="ts" setup>import { ref } from 'vue';// 点击登录,弹出底部弹出框// 定义弹出层的引用const popupRef = ref(null);// 点击登录时调用的方法function openPopup() {// 打开弹出层popupRef.value.open();// 隐藏底部导航uni.hideTabBar();}// 关闭弹出层时显示底部导航栏function closePopup() {// 关闭弹出层popupRef.value.close();// 显示底部导航uni.showTabBar();}const menuItems = ref([{ icon: '/static/my/one.png', text: '个人信息' },{ icon: '/static/my/two.png', text: '浏览历史' },{ icon: '/static/my/three.png', text: '我的收藏' },{ icon: '/static/my/four.png', text: '退出登录' }]);
</script>

隐藏前:

隐藏后:

全部代码:

<template><view class="page"><!-- <view class="header"><view class="header-icons"><uni-icons custom-prefix="iconfont" type="scan" size="24" color="#FFFFFF"></uni-icons><uni-icons custom-prefix="iconfont" type="settings" size="24" color="#FFFFFF"></uni-icons></view></view> --><view class="user-info"><!-- 			<image class="avatar" src="https://ai-public.mastergo.com/ai/img_res/1bd351b304f6817824d478be18fa92b4.jpg"mode="aspectFill"></image> --><text class="my">我的</text><image class="avatar" src="/static/my/mr.png" mode="aspectFill"></image><!-- <text class="username">用户DGF123</text> --><text class="userlogin" @click="openPopup">请登录></text></view><view class="menu-list"><view class="menu-item" v-for="(item, index) in menuItems" :key="index"><!-- 		<uni-icons :type="item.icon" size="24" color="#007AFF"></uni-icons> --><!-- 图标 --><image class="menu-icon" :src="item.icon" mode=""></image><!-- 文字 --><text class="menu-text">{{ item.text }}</text><uv-icon name="arrow-right" color="#6D6D6D" size="14"></uv-icon></view></view><!-- 弹出层 --><uv-popup ref="popupRef" mode="bottom" border-radius="10px 10px 0 0" background-color="#fff" zIndex="99"safeAreaInsetBottom="true"><view style="width: 600rpx; padding: 30rpx;"><text style="font-size: 32rpx; font-weight: bold;">登录提示</text><text style="font-size: 28rpx; color: #666; margin-top: 20rpx; display: block;">请登录后查看完整内容。</text><button style="background-color: #007AFF; color: #FFFFFF; padding: 20rpx; margin-top: 30rpx;">去登录</button><view style="text-align: right; margin-top: 20rpx;"><uv-icon name="close" color="#6D6D6D" size="40" @click="closePopup"></uv-icon></view></view></uv-popup></view>
</template><script lang="ts" setup>import { ref } from 'vue';// 点击登录,弹出底部弹出框// 定义弹出层的引用const popupRef = ref(null);// 点击登录时调用的方法function openPopup() {// 打开弹出层popupRef.value.open();// 隐藏底部导航uni.hideTabBar();}// 关闭弹出层时显示底部导航栏function closePopup() {// 关闭弹出层popupRef.value.close();// 显示底部导航uni.showTabBar();}const menuItems = ref([{ icon: '/static/my/one.png', text: '个人信息' },{ icon: '/static/my/two.png', text: '浏览历史' },{ icon: '/static/my/three.png', text: '我的收藏' },{ icon: '/static/my/four.png', text: '退出登录' }]);
</script><style scoped lang="scss">page {height: 100%;background-color: #F6F6F6;}.page {display: flex;flex-direction: column;min-height: 100%;}.header {background-color: #007AFF;padding: 44rpx 32rpx 20rpx;display: flex;justify-content: space-between;align-items: center;}.title {color: #FFFFFF;font-size: 36rpx;font-weight: bold;}.header-icons {display: flex;gap: 20rpx;}/* 	.user-info {background: linear-gradient(180deg, #007AFF 0%, #3A98FF 100%);padding: 40rpx 0 60rpx;display: flex;flex-direction: column;align-items: center;} */.user-info {background-image: linear-gradient(180deg, #007AFF 0%, rgb(203, 226, 254) 100%);background-size: cover, auto;height: 560rpx;/* 覆盖整个元素区域,线性渐变自动 */background-position: center, center;/* 两个背景都居中 */padding: 40rpx 0 60rpx;display: flex;flex-direction: column;align-items: center;}.my {color: #FFFFFF;font-size: 32rpx;font-weight: 500;margin-bottom: 80rpx;margin-top: 26rpx;}.avatar {width: 120rpx;height: 120rpx;border-radius: 60rpx;margin-bottom: 20rpx;}.username {color: #FFFFFF;font-size: 32rpx;font-weight: 500;}.userlogin {font-weight: 500;font-size: 32rpx;color: #FFFFFF;line-height: 32rpx;font-weight: 500;padding: 20rpx 34rpx;background: #2D8BFF;border-radius: 430rpx 430rpx 430rpx 430rpx;}.menu-list {background-color: #FFFFFF;border-radius: 20rpx;margin: -200rpx 32rpx 0;padding: 20rpx 0;box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);}.menu-item {display: flex;align-items: center;padding: 28rpx 32rpx;border-bottom: 1rpx solid #F0F0F0;}.menu-icon {width: 36rpx;height: 36rpx;}.menu-item:last-child {border-bottom: none;}.menu-text {flex: 1;margin-left: 20rpx;font-size: 28rpx;color: #333333;}.tab-bar {display: flex;justify-content: space-around;padding: 16rpx 0;background-color: #FFFFFF;border-top: 1rpx solid #EEEEEE;margin-top: auto;}.tab-item {display: flex;flex-direction: column;align-items: center;}.tab-text {font-size: 24rpx;color: #999999;margin-top: 8rpx;}.active-text {color: #007AFF;}
</style>


http://www.ppmy.cn/server/165694.html

相关文章

Sentinel的安装和做限流的使用

一、安装 Release v1.8.3 alibaba/Sentinel GitHubA powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件) - Release v1.8.3 alibaba/Sentinelhttps://github.com/alibaba/Senti…

Pytorch与大模型有什么关系

PyTorch 是 深度学习领域最流行的框架之一&#xff0c;在大模型的训练、推理、优化等方面发挥了重要作用。 大模型&#xff08;如 GPT、LLaMA、Stable Diffusion&#xff09;大多是基于 PyTorch 进行开发和训练的。 1. PyTorch 在大模型中的作用 大模型&#xff08;如 ChatGP…

网络面试题(第一部分)

一、ARP工作原理 首先ARP工作在数据链路层&#xff0c;功能是将IP地址转换成MAC地址。例如主机A想向主机B发送消息&#xff0c;首先会查看自己ARP表中是否有主机B对应的MAC地址&#xff0c;如果有则按照ARP表中对应的MAC地址表发送&#xff0c;否则就以广播的形式发送数据包&a…

计算机网络之数据链路层(数据链路层的功能)

帧同步&#xff1a; 数据链路层将网络层传下来的数据报封装成帧&#xff0c;为了区分不同的帧&#xff0c;需要在每个帧的开头和结尾添加特殊的标记&#xff0c;以实现帧的定界和同步。这样&#xff0c;接收方就能准确地识别出一个帧的开始和结束。 差错控制&#xff1a; 在…

网络爬虫学习:应用selenium获取Edge浏览器版本号,自动下载对应版本msedgedriver,确保Edge浏览器顺利打开。

一、前言 我从24年11月份开始学习网络爬虫应用开发&#xff0c;经过2个来月的努力&#xff0c;于1月下旬完成了开发一款网络爬虫软件的学习目标。这里对本次学习及应用开发进行一下回顾总结。 前几天我已经发了一篇日志&#xff08;网络爬虫学习&#xff1a;应用selenium从搜…

处理数据及其选择关键列进行一次聚类

1. 数据加载与初步处理 # 文件路径 file_path ../data/all_database_result.csv# 读取CSV文件到DataFrame df pd.read_csv(file_path)# 选择特定的特征列 selected_features [Q10, Q12, Q13, Q14]# 缺失值处理&#xff1a;这里简单地删除含有任何缺失值的行 df.dropna(subse…

在 Linux 中,进程的状态 I 表示什么

在 Linux 中&#xff0c;进程的状态 I 表示 Idle&#xff08;空闲&#xff09;状态。进程处于 I 状态通常表示它处于 内核休眠 状态&#xff0c;即正在等待某些 I/O 操作或者资源。 不过&#xff0c;I 状态在进程列表中并不常见&#xff0c;它通常出现在 内核线程&#xff08;…

通过docker安装部署deepseek以及python实现

前提条件 Docker 安装:确保你的系统已经安装并正确配置了 Docker。可以通过运行 docker --version 来验证 Docker 是否安装成功。 网络环境:保证设备有稳定的网络连接,以便拉取 Docker 镜像和模型文件。 步骤一:拉取 Ollama Docker 镜像 Ollama 可以帮助我们更方便地管理…