展开微件

尝试一下在线预览

此示例演示如何将 BasemapGallery 微件实例添加到 展开 微件。 展开微件有助于隐藏原本会阻塞部分视图的 UI 元素。 单击代表 BasemapGallery 的图标以查看展开微件(在本例中为 BasemapGallery 微件)内的内容。 您可以通过单击折叠图标来折叠内容。

创建展开微件实例时,必须将微件引用的 view  和 content  设置为 DOM 节点。 此示例中的内容是包含 BasemapGallery 微件实例的 DOM 节点。

                   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Create a BasemapGallery widget instance and set
// its container to a div element

const basemapGallery = new BasemapGallery({
  view: view,
  container: document.createElement("div")
});

// Create an Expand instance and set the content
// property to the DOM node of the basemap gallery widget

const bgExpand = new Expand({
  view: view,
  content: basemapGallery
});

// Add the expand instance to the ui

view.ui.add(bgExpand, "top-right");

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.