当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
我终于逃离了互联网,却陷入了迷茫
成都高新南区 高新西区 东部新区 多边形范围点位 AOI 高德
程序员写代码日常 | 每日趣闻
Usage of permute() function in pytorch
实现统一账号登录,sonarqube集成ldap
WordPress博客问答小插件
信号和槽的绑定
【云原生】灰度发布、蓝绿发布、滚动发布、灰度发布解释
numpy PIL tensor之间的相互转换
大佬们,我有点不明白:为什么oracle-cdc的文档写connector可以做到exactly-o
IDEA如何创建父子工程
力扣第二周错题集
软件测试技术之如何编写测试用例(2)
PyTorch安装——安装PyTorch前在conda搭建虚拟环境的报错
kubernetes部署ldap
Nacos入门学习
ClickHouse卸载、重安装
DPDK mlx5 驱动使用报错
Linux定时任务脚本执行时mysqldump备份异常的问题
如何画一张架构图(内含知识图谱)









