如果我有
Chrome Extension context menu
对于子菜单,我如何禁用父菜单,以便在启用父菜单之前无法访问子菜单项?
chrome.contextMenus.create({
id: "parentMenu",
title: "Parent Menu",
contexts: ["browser_action"],
enabled: false
});
// Create a submenu with two radio buttons
chrome.contextMenus.create({
parentId: "parentMenu",
title: "Submenu1",
contexts: ["browser_action"],
type: "radio",
checked: true,
onclick: function (evt) {}
});
chrome.contextMenus.create({
parentId: "parentMenu",
title: "Submenu2",
contexts: ["browser_action"],
type: "radio",
onclick: function (evt) {}
});
即使parentMenu被标记为disabled(禁用),它也不是disabled(禁用)。当我禁用子菜单时,它们确实会按预期禁用。