WebView側はvueプロジェクトです
WebView は、vue ページの <title> タグのコンテンツを取得します。
ルーターの構成時に名前の値を設定し、ページがジャンプしてルートが変更されるたびにページのタイトルを動的に変更します。これは、フロント ガードをルーティングすることで実現できます。
{
path: "/",
redirect: "login",
},
{
path: "/login",
component: () => import("../pages/login.vue"),
name: "登录",
},
{
path: "/index",
component: () => import("../pages/index.vue"),
name: "首页",
},
// // 跳转之前
router.beforeEach((to, from, next) => {
document.title = to.name;
next();
});
Webview 側は uniapp プロジェクトです
Webview ページの onLoad にタイトルを設定します。
wx.setNavigationBarTitle({
title: '当前页面'})