ui.data.ActiveDictionary
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Một vùng chứa giống như từ điển cho dữ liệu để dùng trong các thành phần giao diện người dùng.
Khi một thuộc tính của ui.data.ActiveDictionary (ví dụ: myButton.style()) được cập nhật, thành phần mà thuộc tính đó thuộc về sẽ tự động được cập nhật. Ví dụ: myButton.style().set('color', 'red') sẽ thay đổi màu văn bản của nút thành màu đỏ.
Cách sử dụng | Giá trị trả về |
---|
ui.data.ActiveDictionary(object, allowedProperties) | ui.data.ActiveDictionary |
Đối số | Loại | Thông tin chi tiết |
---|
object | Đối tượng, không bắt buộc | Một đối tượng JavaScript có các thuộc tính và giá trị để khởi tạo đối tượng này. |
allowedProperties | List<String>, không bắt buộc | Một mảng gồm các thuộc tính được phép cho đối tượng này. Nếu không xác định, thì mọi thuộc tính đều được cho phép. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eui.data.ActiveDictionary is a container for storing data used by UI components, similar to a dictionary.\u003c/p\u003e\n"],["\u003cp\u003eChanges to an ActiveDictionary's properties automatically update the associated UI component, ensuring data and UI stay in sync.\u003c/p\u003e\n"],["\u003cp\u003eYou can create an ActiveDictionary using \u003ccode\u003eui.data.ActiveDictionary(object, allowedProperties)\u003c/code\u003e and optionally provide initial data and allowed properties.\u003c/p\u003e\n"]]],[],null,["# ui.data.ActiveDictionary\n\n\u003cbr /\u003e\n\nA dictionary-like container for data for use in UI components.\n\n\u003cbr /\u003e\n\nWhen a property of a ui.data.ActiveDictionary (e.g. myButton.style()) is updated, the component it belongs to is automatically updated. For example, myButton.style().set('color', 'red') would change the color of button's text to red.\n\n| Usage | Returns |\n|----------------------------------------------------------------|--------------------------|\n| `ui.data.ActiveDictionary(`*object* `, `*allowedProperties*`)` | ui.data.ActiveDictionary |\n\n| Argument | Type | Details |\n|---------------------|--------------------------|---------------------------------------------------------------------------------------------|\n| `object` | Object, optional | A JavaScript object with properties and values to initialize this object with. |\n| `allowedProperties` | List\\\u003cString\\\u003e, optional | An array of allowed properties for this object. If undefined, then any property is allowed. |"]]