如何使用 Esri JS API 4.0 将多个操作附加到弹出模板
How to attach multiple actions to a popup template using Esri JS API 4.0
我正在尝试使用 ESRI js api 4.0 将多个操作附加到弹出模板,它不会向控制台抛出任何错误,但也不显示操作,我可以将一个操作附加到一个模板,它工作得很好我正在关注这个 reference guide。
代码:https://jsbin.com/moqajuwugu/edit?html,output
// Add this action to the popup so it is always available in this view
var measureThisAction = {
title: "Measure Length",
id: "measure-this",
image: "Measure_Distance16.png"
};
var someotherAction = {
title: "Someother Action",
id: "other-action-this",
image: "Measure_Distance16.png"
};
var template = { // autocasts as new PopupTemplate()
title: "Trail run",
content: "{name}",
actions: [measureThisAction]
};
template.actions.push(someotherAction);
任何帮助都会很棒。
我没有发现你分享的fiddler有任何问题。我得到 2 个自定义选项。由于图像丢失,我可能看不到图像。但是我得到 2 tool-tips。根据文档,当操作 <3 时显示图像和文本,当其 >=3 时,仅显示图像并且标题显示为 tool-tip.
The title of the action. When there are fewer than three actions
defined in a popup, this text is displayed to the right of the icon or
image representing the action. If there are three or more actions in
the popup, then this text is used as a tooltip on the action.
https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#actions
我正在尝试使用 ESRI js api 4.0 将多个操作附加到弹出模板,它不会向控制台抛出任何错误,但也不显示操作,我可以将一个操作附加到一个模板,它工作得很好我正在关注这个 reference guide。
代码:https://jsbin.com/moqajuwugu/edit?html,output
// Add this action to the popup so it is always available in this view
var measureThisAction = {
title: "Measure Length",
id: "measure-this",
image: "Measure_Distance16.png"
};
var someotherAction = {
title: "Someother Action",
id: "other-action-this",
image: "Measure_Distance16.png"
};
var template = { // autocasts as new PopupTemplate()
title: "Trail run",
content: "{name}",
actions: [measureThisAction]
};
template.actions.push(someotherAction);
任何帮助都会很棒。
我没有发现你分享的fiddler有任何问题。我得到 2 个自定义选项。由于图像丢失,我可能看不到图像。但是我得到 2 tool-tips。根据文档,当操作 <3 时显示图像和文本,当其 >=3 时,仅显示图像并且标题显示为 tool-tip.
The title of the action. When there are fewer than three actions defined in a popup, this text is displayed to the right of the icon or image representing the action. If there are three or more actions in the popup, then this text is used as a tooltip on the action.
https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#actions