当前位置:网站首页>Dynamically modify the title of the navigation bar in uniapp
Dynamically modify the title of the navigation bar in uniapp
2022-08-03 03:33:00 【The angel of similar】
uniappDynamically modify the navigation bar title in
使用场景:从A页面跳转至B页面,在APages have multiple message types,跳转BThe page displays a different navigation bar title,如视频所示:
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
边栏推荐
猜你喜欢
随机推荐
ClickHouse常用函数速查大全
堆的应用:堆排序和TOP-K问题
PSSecurityException
基于 Cyclone IV 在 Quartus 中配置 IP 核中的 PLL、RAM 与 FIFO 的详细步骤及仿真验证
ClickHouse数据类型
AttributeError: module ‘xxx‘ has no attribute
SPI机制是什么?
sql问题,如何能做到先声明表的名称,例如product202201,表示2022年一月份的货物表,再在声明过的表中查找,下面的代码运行时有错误显示找不到表table_name,请问改如何进行修改
iScroll系列之下拉刷新 + 上拉加载更多
韦东山 数码相框 项目学习(五)libjpeg-turbo的移植
软件测试技术之如何编写测试用例(2)
The LVS load balancing cluster and the deployment of the LVS - NAT experiment
部门之间,互不信任正常吗?(你是否遇到过)
Auto.js Pro 计算脚本运行时间
kubernetes部署ldap
IDEA如何创建同级工程
uniapp运行到手机,基座提示本应用无法独立运行,需要与hbuilderX 搭配使用
有大佬知道 使用flinksql是 同步的日期字段为null的话怎么处理吗
【TA-霜狼_may-《百人计划》】美术2.5 模型常见问题及规范
网易数帆陈谔:云原生“牵手”低代码,加速企业数字化转型









