uniapp写的h5,怎么根据页面详情,设置不同的标题

在改造项目的过程中,遇到个问题,page.json中的标题是写死的,那么能否根据同一页面,不同商品显示不同标题呢?
第一步:将page.json路由中的"navigationBarTitleText": "",置空,如下:

javascript 复制代码
		{
		 "root": "pages/goods_details",
		  	"name": "goods_details",
		  	"pages": [{
		  		"path": "index",
		  			"style": {
		  				"navigationBarTitleText": "",//商品详情
		  				"navigationStyle": "custom"//自定义tabbar
		  			}
		  		}
		  	]
		},
		{
			"path": "discoverDetails/index",
			"style": {
				"navigationBarTitleText": "",//内容详情
				"navigationBarBackgroundColor": "#ffffff",
				"app-plus": {
					// #ifdef APP-PLUS
					"titleNView": {
						"type": "default"
					}
					// #endif
				}
			}
		},

步骤二:拿到详情接口,给每个商品详情赋值标题

javascript 复制代码
getInfo(){
	接口Api(this.community_id).then(res=>{
		this.infoData = res.data;
	      //内容标题
	      uni.setNavigationBarTitle({
	      	title: res.data.title.substring(0, 13) + '...'
	      });
		// #ifdef H5
		this.ShareInfo();
		// #endif
	}).catch(err => {
		return this.$util.Tips({
			title: err
		});
	});
},
相关推荐
weixin_4277716120 分钟前
前端调试隐藏元素
前端
爱上好庆祝1 小时前
学习js的第五天
前端·css·学习·html·css3·js
C澒2 小时前
IntelliPro 产研协作平台:基于 AI Agent 的低代码智能化配置方案设计与实现
前端·低代码·ai编程
一袋米扛几楼982 小时前
【Git】规范化协作:详解 GitHub 工作流中的 Issue、Branch 与 Pull Request 最佳实践
前端·git·github·issue
网络点点滴2 小时前
前端与后端的区别与联系
前端
EnCi Zheng2 小时前
M5-markconv自定义CSS样式指南 [特殊字符]
前端·css·python
kyriewen2 小时前
你的网页慢,用户不说直接走——前端性能监控教你“读心术”
前端·性能优化·监控
广州华水科技2 小时前
北斗GNSS变形监测在大坝安全监测中的应用与优势分析
前端
前端老石人3 小时前
前端开发中的 URL 完全指南
开发语言·前端·javascript·css·html
CAE虚拟与现实3 小时前
五一假期闲来无事,来个前段、后端的说明吧
前端·后端·vtk·three.js·前后端