当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
openCV第二篇
实现统一账号登录,sonarqube集成ldap
leetcode:140. 单词拆分 II
网易数帆陈谔:云原生“牵手”低代码,加速企业数字化转型
IPv4编址;A类、B类、C类、D类、E类IP地址(IP地址;网络地址和主机地址;子网掩码;网关;广播地址;)
【静态类型和动态类型 编译检查和运行检查 Objective-C中】
leetcode:172. 阶乘后的零
iScroll系列之下拉刷新 + 上拉加载更多
vs studio 安装opencv 环境
Useful Monitoring Scripts What you want part1 in Oracle
机器学习【KNN案例、API、总结】
【数据分析】基于MATLAB实现SVDD决策边界可视化
Jenkins2.328+sonarqube7.9 实现代码自动化检测
Likou second week wrong questions collection
【Arduino】重生之Arduino 学僧(2)----Arduino语言
Disable the token and update the token function without awareness
LabVIEW程序框图保存为图像
关于 Redis 必问面试题,你知道哪些?
leetcode:153. 寻找旋转排序数组中的最小值
信号和槽的绑定