uniapp dynamically modify the page title

Code directly

uni.setNavigationBarTitle ()

			try{
    
    
				if(option.from == 'case'){
    
    
					this.type = 1
					uni.setNavigationBarTitle({
    
    
					  title: '案例详情'
					})
				} else {
    
    
					this.type = 0
				}
			}catch(e){
    
    
				//TODO handle the exception
			}

Insert picture description here

Digression

The complete parameter is similar to the finally in try catch finally

try {
    
    
    tryCode - 尝试执行代码块
}
catch(err) {
    
    
    catchCode - 捕获错误的代码块
}
finally {
    
    
    finallyCode - 无论 try / catch 结果如何都会执行的代码块
}

Guess you like

Origin blog.csdn.net/hu1628299958/article/details/114680773