当前位置:网站首页>uniapp中动态修改导航栏标题
uniapp中动态修改导航栏标题
2022-08-03 02:48:00 【天使的同类】
uniapp中动态修改导航栏标题
使用场景:从A页面跳转至B页面,在A页面有多种消息类型,跳转B页面则显示不同的导航栏标题,如视频所示:
A页面代码如下:
onClick(type) {
uni.navigateTo({
url: `./messageDetails?type=` + type
})
},
B页面代码如下:
<template>
<view class="container">
<text>{
{
text}}</text>
</view>
</template>
<script>
export default {
data() {
return {
text: ''
}
},
onLoad(options) {
if (options.type == 1) {
this.text = '消息通知'
uni.setNavigationBarTitle({
title: '消息通知'
});
} else if (options.type == 2) {
this.text = '互动消息'
uni.setNavigationBarTitle({
title: '互动消息'
});
} else if (options.type == 3) {
this.text = '系统消息'
uni.setNavigationBarTitle({
title: '系统消息'
});
} else if (options.type == 4) {
this.text = '其他'
uni.setNavigationBarTitle({
title: '其他'
});
}
},
methods: {
}
}
</script>
<style lang="scss">
.container {
padding: 0;
margin: 0;
}
</style>
Who we were does not dictate who we will be
边栏推荐
- Incorrect datetime value: '2022-01-01' for function str_to_date
- Methods annotated with ‘@Async‘ must be overridable
- zyMedia系列之播放视频
- The LVS load balancing cluster and the deployment of the LVS - NAT experiment
- 【每日一题】622. 设计循环队列
- 任意版本JLink驱动官方下载指引
- leetcode:172. 阶乘后的零
- Topic Modeling of Short Texts: A Pseudo-Document View
- mysql-installer安装教程(详细图文)
- 在VScode里调试ROS程序
猜你喜欢
随机推荐
QT之鼠标和键盘事件重写
企业上云规划与云原生环境设计
基于 Cyclone IV 在 Quartus 中配置 IP 核中的 PLL、RAM 与 FIFO 的详细步骤及仿真验证
【每日一题】622. 设计循环队列
成都高新南区 高新西区 东部新区 多边形范围点位 AOI 高德
【GraphQL】使用Hot Chocolate和.NET 6构建GraphQL应用
Excel 如何比较两列字符串是否相同?
vant-field中colon属性为true报错
Wei Dongshan Digital Photo Frame Project Learning (5) Transplantation of libjpeg-turbo
服务器在线测速系统源码
rancher集成ldap,实现统一账号登录
禁用token及无感知更新token功能实现
Rust Web(三)—— 通过sqlx连接数据库(MySQL)
五大靠谱的婚恋相亲APP详细特点缺点分析!
如何画一张架构图(内含知识图谱)
Get the first/last day of the current week, month, quarter in MySQL
【TA-霜狼_may-《百人计划》】美术2.5 模型常见问题及规范
370万欧元!西班牙iPronics加速可重构光子芯片商用
PSSecurityException
JS高级 之 Proxy-Reflect 使用详解









