-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zh-CN: create
pageAction.openPopup()
(#25272)
- Loading branch information
1 parent
75282e4
commit 8a4477c
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
files/zh-cn/mozilla/add-ons/webextensions/api/pageaction/openpopup/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: pageAction.openPopup() | ||
slug: Mozilla/Add-ons/WebExtensions/API/pageAction/openPopup | ||
l10n: | ||
sourceCommit: 43e3ff826b7b755b05986c99ada75635c01c187c | ||
--- | ||
|
||
{{AddonSidebar}} | ||
|
||
打开页面操作的弹窗。 | ||
|
||
你只能在[用户操作](/zh-CN/docs/Mozilla/Add-ons/WebExtensions/User_actions)的处理器中调用此函数。 | ||
|
||
## 语法 | ||
|
||
```js-nolint | ||
browser.pageAction.openPopup() | ||
``` | ||
|
||
### 参数 | ||
|
||
无。 | ||
|
||
### 返回值 | ||
|
||
将不带参数地兑现的 [`Promise`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise)。 | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} | ||
|
||
## 示例 | ||
|
||
打开页面操作的弹窗: | ||
|
||
```js | ||
browser.menus.create({ | ||
id: "open-popup", | ||
title: "open popup", | ||
contexts: ["all"], | ||
}); | ||
|
||
browser.menus.onClicked.addListener(() => { | ||
browser.pageAction.openPopup(); | ||
}); | ||
``` | ||
|
||
{{WebExtExamples}} |