公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ui.Button
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
带有文字标签的可点击按钮。
用法 | 返回 |
---|
ui.Button(label, onClick, disabled, style, imageUrl) | ui.Button |
参数 | 类型 | 详细信息 |
---|
label | 字符串,可选 | 按钮的标签。默认为空字符串。 |
onClick | 函数(可选) | 点击按钮时触发的回调。回调会传递按钮 widget。 |
disabled | 布尔值,可选 | 按钮是否已停用。默认值为 false。 |
style | 对象,可选 | 一个对象,包含允许的 CSS 样式及其要为此 widget 设置的值。默认为空对象。 |
imageUrl | 字符串,可选 | 可选的图片网址。如果提供,按钮将呈现为图片,并且值文本将在鼠标悬停时显示。仅允许使用数据网址和从 gstatic.com 加载的图标。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eCreates a clickable button widget with customizable text label, click functionality, and appearance.\u003c/p\u003e\n"],["\u003cp\u003eAllows setting an optional image for the button, displaying the label text on hover.\u003c/p\u003e\n"],["\u003cp\u003eCan be disabled to prevent user interaction.\u003c/p\u003e\n"],["\u003cp\u003eProvides flexibility in styling through CSS properties.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes a straightforward constructor function for instantiation with various parameters.\u003c/p\u003e\n"]]],["The `ui.Button` function creates a clickable button. It accepts optional arguments: `label` (text), `onClick` (callback function on click), `disabled` (boolean to disable), `style` (CSS styling), and `imageUrl` (image for the button). When clicked, the `onClick` callback is triggered, receiving the button widget. The button can be customized with a text label or an image, and its appearance can be altered via CSS. Only specific URLs are allowed for the image.\n"],null,["# ui.Button\n\n\u003cbr /\u003e\n\nA clickable button with a text label.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------------------------------------------------|-----------|\n| `ui.Button(`*label* `, `*onClick* `, `*disabled* `, `*style* `, `*imageUrl*`)` | ui.Button |\n\n| Argument | Type | Details |\n|------------|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `label` | String, optional | The button's label. Defaults to an empty string. |\n| `onClick` | Function, optional | A callback fired when the button is clicked. The callback is passed the button widget. |\n| `disabled` | Boolean, optional | Whether the button is disabled. Defaults to false. |\n| `style` | Object, optional | An object of allowed CSS styles with their values to be set for this widget. Defaults to an empty object. |\n| `imageUrl` | String, optional | Optional image url. If provided, the button will be rendered as an image and the value text will be shown on mouse hover. Only data: urls and icons loaded from gstatic.com are allowed. |"]]