Logic(逻辑)¶
Applications often require data to be modified or enriched before it can be presented to the user or visualized in some other way. Similarly, the application might require additional information to run the way you intend. For example, you may want to indicate that a widget must have the appropriate configuration to run successfully, or that certain information appears based on the state of the application. Slate provides multiple primitives to manage and manipulate states and data.
Functions are JavaScript snippets that can read Handlebars and return any type of output. Functions can process data coming from queries, take in states of widgets or variables and construct new values, or prepare classes for widgets. Learn more about functions in Slate.
Handlebars pass values from one component to another, using the output of a function in a widget or a query in an event. Handlebars give you access to all the information currently flowing through your application via two curly brackets {{ }}. Learn more about using Handlebars in Slate.
Variables store values to save a specific state, store user inputs, or set defaults. Set the value for variables via URL parameters or update them via events. Learn more about variables in Slate.
Events are made up of an individual event and a user action. Events trigger activity in your application; for example, you can configure an Event to submit a query when a button is selected or display a toast after a dialog is closed. Events and actions handle all kinds of automated interactions inside of Slate. Learn more about Events and Actions in Slate.
中文翻译¶
逻辑¶
应用程序通常需要在数据呈现给用户或以其他方式可视化之前对其进行修改或丰富。同样,应用程序可能需要额外的信息才能按预期方式运行。例如,您可能希望指示某个小部件必须具有适当的配置才能成功运行,或者某些信息会根据应用程序的状态显示。Slate 提供了多种原语(primitives)来管理和操作状态及数据。
函数(Functions) 是能够读取 Handlebars 并返回任意类型输出的 JavaScript 代码片段。函数可以处理来自查询的数据,接收小部件或变量的状态并构建新值,或者为小部件准备类。了解更多关于 Slate 中的函数。
Handlebars 将值从一个组件传递到另一个组件,使用函数在小部件中的输出或事件中的查询。Handlebars 通过双花括号 {{ }} 让您访问当前在应用程序中流动的所有信息。了解更多关于 在 Slate 中使用 Handlebars。
变量(Variables) 存储值以保存特定状态、存储用户输入或设置默认值。通过 URL 参数设置变量的值,或通过事件更新它们。了解更多关于 Slate 中的变量。
事件(Events) 由单个事件和用户操作组成。事件触发应用程序中的活动;例如,您可以配置一个事件,在按钮被选中时提交查询,或在对话框关闭后显示提示信息。事件和操作处理 Slate 内部各种自动化的交互。了解更多关于 Slate 中的事件和操作。