作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个基本的 chrome 扩展。后发现root context menu can only contain one item per plugin ,我希望至少能够为父级命名而不是我的插件名称:
chrome.contextMenus.create({
title: "Child Item 1",
contexts:["selection"],
});
chrome.contextMenus.create({
title: "Child Item 2",
contexts:["selection"],
});
最佳答案
我这样做的方法是创建一个带有自定义 title
的父项。和 id
,然后将我需要的所有项目作为子项添加到父项(到我的 script.js
文件):
chrome.contextMenus.create({
title: "Custom Parent Name",
contexts:["selection"],
id: "parent",
});
chrome.contextMenus.create({
title: "Child Item 1",
contexts:["selection"],
parentId: "parent",
id: "child1",
});
chrome.contextMenus.create({
title: "Child Item 2",
contexts:["selection"],
parentId: "parent",
id: "child2",
});
关于google-chrome - Chrome 扩展 : How to create context menu with custom name, 而不是插件名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32633433/
我是一名优秀的程序员,十分优秀!