当前位置:网站首页>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
边栏推荐
猜你喜欢
征集 |《新程序员》专访“Apache之父”Brian Behlendorf,你最想问什么?
Wei Dongshan Digital Photo Frame Project Learning (5) Transplantation of libjpeg-turbo
程序员写代码日常 | 每日趣闻
超级复杂可贴图布局的初级智能文本提示器
Topic Modeling of Short Texts: A Pseudo-Document View
370万欧元!西班牙iPronics加速可重构光子芯片商用
leetcode:151. 颠倒字符串中的单词
Redshift贴logo的方法
【每日一题】622. 设计循环队列
qt opengl 使用不同的颜色绘制线框三角形
随机推荐
leetcode:139. 单词拆分
Scala基础【异常、隐式转换、泛型】
ROS通信模块:秒懂话题通信
重定向printf到USB CDC、串口2
【GO记录】从零开始GO语言——用GO语言做一个示波器(二)基于arduino的简易示波器
JS高级 之 Proxy-Reflect 使用详解
一些面试的总结
Mysql-如何进行慢SQL查询
leetcode:151. 颠倒字符串中的单词
IDEA基本使用-创建和删除项目
PSSecurityException
mysql binlog日期解析成yyyy-MM-dd
LabVIEW程序框图保存为图像
C语言——-动态内存开辟与管理(malloc,free,calloc,realloc)+柔性数组
Wei Dongshan Digital Photo Frame Project Learning (5) Transplantation of libjpeg-turbo
monkey 压测
iScroll系列之下拉刷新 + 上拉加载更多
uniapp运行到手机,基座提示本应用无法独立运行,需要与hbuilderX 搭配使用
Go新项目-编译项目的细节(4)
TRACE32——使用读写断点