首页 > 解决方案 > 如何让 NW.js 不忽略我的 win.title 集?

问题描述

代码:

// title set to "foo" by default
var win = nw.Window.get();
console.log(win.title);
win.title = 'bar';
console.log(win.title);

预期输出:

foo
bar

实际输出:

foo
foo

根据手册:

win.title

获取或设置窗口的标题。

来源:http ://docs.nwjs.io/en/v0.13.0-rc3/References/Window/#wintitle

标签: nwjs

解决方案


根据文档,您的代码应该可以工作。因此,您可能想要针对 NW.js 提交错误。

也就是说,以下似乎是一个有效的解决方法:

const win = nw.Window.get();
win.window.document.title = 'bar';

推荐阅读