当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
The LVS load balancing cluster and the deployment of the LVS - NAT experiment
一次偶然的钓鱼文件分析
[@property enhancement in Objective-C language]
第八章 字符输入输出和输入验证
mysql8默认密码丢失,如何更改密码详细步骤??
HCIP第十八天
流程图(1)
Incorrect datetime value: '2022-01-01' for function str_to_date
实现统一账号登录,sonarqube集成ldap
ClickHouse—高级
工作两年成跳槽高峰期,程序员会在一家公司待多久?
els 计分
SqlSession [[email protected]]
vs studio install opencv environment
Jenkins2.328+sonarqube7.9 实现代码自动化检测
ROS通信模块:秒懂话题通信
JVM internal structure and various modules operation mechanism
Summary of some interviews
Spark SQL简介
豆瓣评分9.3的好书,文末给大家抽奖送几本!









