专栏名称: AT阿宝哥
15年IT互联网从业经验,专注产品方案,人才...
目录
相关文章推荐
闽南日报  ·  紧急提醒:不下载!不共享!不转账! ·  22 小时前  
中国消费者报  ·  3·15在行动 | ... ·  昨天  
中国消费者报  ·  3·15在行动 | ... ·  昨天  
河南日报  ·  央视曝光!支付宝回应→ ·  2 天前  
51好读  ›  专栏  ›  AT阿宝哥

《Axure官方文档译读》之0503:Conditional Logic(条件逻辑)

AT阿宝哥  · 简书  ·  · 2020-01-16 01:49

正文

Axure RP

Conditional Logic

条件逻辑

Conditional logic is a system of rules you can use to specify when an interaction you've built should occur in the web browser. For example, you can stipulate that a button click will advance users to the next page in your prototype only if they have filled in all required fields in a form.

条件逻辑是一个规则系统,您可以使用它来指定您构建的交互何时应该出现在web浏览器中。例如,您可以规定,只有当用户在表单中填写了所有必需的字段时,单击按钮才能将用户推进到原型中的下一页。

Think of conditions as having an if/then relationship with their interactions: if the condition is met, then the interaction will be executed.

将条件视为与它们的交互具有 if/then 关系: 如果 满足条件, 将执行交互。

1、Building Conditions

创建条件

image

To add conditional logic to an interaction, hover over the event name and click Enable Cases . In the Condition Builder dialog that appears, click Add Logic .

要将条件逻辑添加到交互中,请将鼠标悬停在事件名称上并单击 Enable Cases 。在出现的 条件生成器 对话框中,单击 添加逻辑

In the Condition Builder , you can configure one or more conditional statements using the fields in each row. A conditional statement compares two values in some way to produce a true or false result:

Condition Builder 中,可以使用每行中的字段配置一个或多个条件语句。条件语句以某种方式比较两个值,生成 true false 结果:

One value — How it compares to — A second value

“一个值——与之相比——第二个值”

image

For example, you can verify that a text field has been filled in with a particular value with the following condition:

text on widget — Text Field — equals — text — your value here

This conditional statement evaluates to true when the target text field's entered text equals the value provided in the rightmost field.

当目标文本字段输入的文本等于最右边字段中提供的值时,此条件语句的计算结果为 true

1.1、Satisfying "All" or "Any" Conditional Statements

满足“所有”或“任何”条件语句

When you set up multiple conditional statements for a case, you can decide whether the case gets executed when all the statements evaluate to true or when just any one statement evaluates to true . You can control this in the dropdown at the top-right of the Condition Builder .

当您为一个case设置多个条件语句时,您可以决定当 所有 语句的值为 true 时,或者当 任意 一个语句的值为 true 时,是否执行case。您可以在 条件生成器 的右上角的下拉菜单中对此进行控制。

image

2、Events With Multiple Conditional Cases (IF and ELSE)

具有多个条件情况的事件(IF和ELSE)

When an event has multiple cases under it, you can use conditional logic to determine which of them will be executed in the web browser. You do this by building IF / ELSE chains.

当一个事件下有多个案例时,您可以使用条件逻辑来确定哪些案例将在web浏览器中执行。您可以通过构建 IF / ELSE 链来实现这一点。

IF / ELSE chains are made up of conditional cases whose conditions depend on one another. Each condition in the chain will only be evaluated if the previous condition "fails" by evaluating to false . Once a condition "passes" by evaluating to true , the prototype will stop evaluating further conditions in the chain.

IF / ELSE 链是由条件条件相互依赖的情况组成的。只有当前一个条件通过赋值为 false “失败”时,才会对链中的每个条件求值。一旦条件通过评估 true *“通过”,原型将停止评估链中的其他条件。

For example, the submit button for a login form might have two conditional Click or Tap cases that do different things depending on whether or not the user has provided valid login credentials.

例如,登录表单的submit按钮可能有两个有条件的 Click或Tap 用例,它们根据用户是否提供了有效的登录凭据而执行不同的操作。

image

If the Email and Password fields both contain the correct values when the button is clicked, the first condition will evaluate to true and its case will be executed, opening the Account Dashboard page. The second case will not be evaluated at all.

如果在单击按钮时电子邮件和密码字段都包含正确的值,则第一个条件的值将为 true ,并执行其大小写,打开帐户仪表板页面。第二种情况根本不会被评估。

If, however, one of the two fields doesn't contain the correct value when the button is clicked, the first condition will evaluate to false and its case will not be executed. The prototype will then move on to the second case and evaluate its condition. The second case has no condition, so it gets executed by default, and the error message is displayed.

但是,如果单击按钮时两个字段 中有一个 不包含正确的值,则第一个条件的值将为 false ,其大小写将不执行。然后,原型将转移到第二种情况,并评估其条件。第二种情况没有条件,因此默认情况下执行它,并显示错误消息。

Tip
提示

Placing an ELSE IF true case (one with no condition) at the end of an IF / ELSE chain is a common way to create a catch-all or "default" case that will always be executed when all other conditions in the chain above it fail. Don't put any other ELSE cases after it, though — their conditions will never be evaluated since the ELSE IF true case evaluates to true automatically.

在一个 IF / ELSE 链的末尾放置一个 ELSE IF true case(一个没有条件的case)是创建一个通吃或“默认”case的常见方法,该case总是在其上链的所有其他条件失败时执行。不要在后面加上任何其他的 ELSE 的情况,虽然-他们的条件将永远不会被评估,因为 ELSE如果真 的情况评估为 *自动。

The example above is fairly simple, but you can add as many ELSE cases to a chain as you like. For instance, the Click or Tap event above could include another ELSE case, above the one for the error message, that opens an administrator user profile when you log in to an admin account. The error message would only be displayed if incorrect credentials were entered for both the admin and non-admin accounts.

上面的例子相当简单,但是您可以向链中添加任意数量的 ELSE 案例。例如,上面的 Click或Tap 事件可能包含另一种 ELSE 情况,在错误消息的情况之上,当您登录到管理帐户时,将打开管理员用户配置文件。只有在管理员和非管理员帐户都输入了不正确的凭据时,才会显示错误消息。

2.1、Creating Multiple IF / ELSE Chains

创建多个IF / ELSE链

By default, the first conditional case under an event is the IF case, and all following cases are ELSE cases in the IF / ELSE chain. You can create additional IF / ELSE chains by changing ELSE cases into IF cases. To do so, right-click a case name and select Toggle IF / ELSE .







请到「今天看啥」查看全文