Dynamic Page Title Settings
Scenario Overview
Implement dynamic page title settings in WeDa applications.
Implementation Steps
-
Differentiate between different clients
On the web side, dynamically set the current page title using the method provided by js.
document.title = 'newTitle'On the Mini Program side, dynamically set the current page title using the official API-setNavigationBarTitle.
wx.setNavigationBarTitle({title: 'newTitle'}) -
Bind events in the WeDa application lifecycle.

$w.wedaContext.platforms.includes("MP")
? wx.setNavigationBarTitle({
title: "newTitle",
})
: (document.title = "newTitle");
Note
$w.wedaContext.platforms.includes("MP") determines whether the application terminal is a Mini Program