ValuePickerCollection

AMD: require(["geoscene/widgets/ValuePicker/ValuePickerCollection"], (ValuePickerCollection) => { /* code goes here */ });
ESM: import ValuePickerCollection from "@geoscene/core/widgets/ValuePicker/ValuePickerCollection.js";
类: geoscene/widgets/ValuePicker/ValuePickerCollection
起始版本:GeoScene Maps SDK for JavaScript 4.27

此类表示值的有序集合,这些值可以分配给 ValuePicker 微件的 component 属性,并且可以在运行时与之交互。有关如何设置的详细信息,请参阅使用任意集合组件来显示预定义列表部分。

示例
// Assign a collection of objects to the ValuePicker.
const collection = new Collection([
  { name: "Isaac Newton", dob: new Date(1643, 0, 4)},
  { name: "Albert Einstein", dob: new Date(1879, 2, 14)},
  { name: "Ernest Rutherford", dob: new Date(1871, 7, 20)}
]);

const valuePicker = new ValuePicker({
  component: new ValuePickerCollection({ collection }),
  values: [collection.at(0)]
});

valuePicker.watch("values", (values) => {
  const scientist = values[0];
  console.log(`${scientist.name} was born on ${scientist.age.toDateString()}`);
});

构造函数

new ValuePickerCollection(properties)
参数
properties Object
optional

有关可能传递给构造函数的所有属性的列表,请参见属性

属性概述

名称 类型 描述
Collection

可以使用 ValuePicker 微件上的播放、下一个和上一个按钮导航或设置动画的值集合。

更多详情
ValuePickerCollection
String对于 ValuePickerCollection,类型总是 "collection"更多详情ValuePickerCollection

属性详细信息

可以使用 ValuePicker 微件上的播放、下一个和上一个按钮导航或设置动画的值集合。

默认值:null
示例
const valuePicker = new ValuePicker({
  values: ["tianditu-image"]
  component: new ValuePickerCollection({
    collection: ["tianditu-image", "oceans", "osm"] // autocast to Collection
  })
});
type Stringreadonly

对于 ValuePickerCollection,类型总是 "collection"

您的浏览器不再受支持。请升级您的浏览器以获得最佳体验。