Google chrome extension 如何设置标题,包含单词和变量?

Google chrome extension 如何设置标题,包含单词和变量?,google-chrome-extension,Google Chrome Extension,我想setBadge和setTitle像 chrome.browserAction.setBadgeText({text: String(badgeText)}); chrome.browserAction.setTitle({text: "The number "+currentDomain+ "is "+ String(badgeText)}); chrome.browserAction.setBadgeBackgroundColor({ color: '#1d2554' }); 但在标题

我想
setBadge
setTitle

chrome.browserAction.setBadgeText({text: String(badgeText)});
chrome.browserAction.setTitle({text: "The number "+currentDomain+ "is "+ String(badgeText)});
chrome.browserAction.setBadgeBackgroundColor({ color: '#1d2554' });
但在标题中保留在清单中设置的标题,并且徽章颜色变为默认蓝色。因为我犯了错误

Uncaught TypeError: Error in invocation of browserAction.setTitle(object details, optional function callback): 
Error at parameter 'details': Unexpected property: 'text'.
我做错了什么?正确的语法是什么


PS:manifest中存在的
default\u title
不起作用-如果未设置,则标题显示清单中的名称,但不是我在background.js中设置的标题。

它应该是标题而不是文本,如:
chrome.browserAction.setTitle({title:“数字”+currentDomain+“是”+String(badgeText)})

此外,您可能希望通过使用模板文字使其更具可读性,因此: {title:`数字${currentDomain}是${String(badgeText)}`}