当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
leetcode:152. 乘积最大子数组
【Arduino】重生之Arduino 学僧(2)----Arduino语言
重定向printf到USB CDC、串口2
MySQL-Explain详解
ClickHouse常用函数速查大全
compose 位移视图
什么是数据标注? 数据标注公司主要做什么?
Mysql-如何进行慢SQL查询
List<Object>转List<User>:
ROS计算图——rqt_graph
TRACE32——使用读写断点
[Static type and dynamic type compile check and run check in Objective-C]
Interconversion between numpy PIL tensors
IDEA如何创建同级工程
大佬们,我有点不明白:为什么oracle-cdc的文档写connector可以做到exactly-o
Likou second week wrong questions collection
Incorrect datetime value: '2022-01-01' for function str_to_date
用 SQL 做数据分析的十大常用功能,附面试原题解答!!
2022-08-02 顾宇佳 学习笔记 多线程
5. Software testing ----- automated testing