
5.5 函数
在“用例编辑器”对话框所有具有“fx”按钮之处,都可以设置函数,Axure RP 8 中提供了非常丰富的函数,例如元件函数、中继器/数据集函数、页面函数、字符串函数和数字函数等。
例如给定一个数集A,假设其中的元素为x。现对A中的元素x施加对应法则f,记作f(x),得到另一数集B。假设B中的元素为y。则y与x之间的等量关系可以用y=f(x)表示,我们把这个关系式就叫函数关系式,简称函数。例如针对某个值求绝对值的函数 y=abs(x),当我们调用该函数,求数值“-5”的绝对值时,调用后得到数值5。
在Axure RP 8中进行交互设计时,函数可以用在条件公式和需要赋值的场合。例如,使用[[Math.abs(OnLoadVariable)+1]]获得 OnLoadVariable 全局变量的绝对值加 1 的值,得到该值后可以放在用例的触发条件中,也可放在赋值语句中。
5.5.1 常用函数
Axure RP 8的常用函数如表5-3所示。
表5-3 Axure RP 8常用函数

(续)

5.5.2 中继器/数据集函数
单击“fx”按钮进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“中继器/数据集”下方,是中继器/数据集函数,如表5-4所示。
表5-4 Axure RP 8中继器/数据集函数

5.5.3 元件函数
单击“fx”按钮进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“元件”下方,是Axure RP 8的元件函数,如表5-5所示。
表5-5 Axure RP 8元件函数

5.5.4 页面函数
单击“fx”按钮进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“页面”下方,是Axure RP 8的页面函数,如表5-6所示。
表5-6 Axure RP 8页面函数

5.5.5 窗口函数
单击“fx”按钮进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“窗口”下方,是Axure RP 8的窗口函数,如表5-7所示。
表5-7 Axure RP 8窗口函数

5.5.6 鼠标指针函数
单击“fx”进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“鼠标指针”下方,是Axure RP 8的鼠标指针函数,如表5-8所示。
表5-8 Axure RP 8鼠标指针函数

5.5.7 数字函数
单击“fx”进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“Number”下方,是Axure RP 8的数字函数,如表5-9所示。
表5-9 Axure RP 8数字函数

5.5.8 字符串函数
单击“fx”进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“字符串”下方,是Axure RP 8的字符串函数,如表5-10所示。
表5-10 Axure RP 8字符串函数

5.5.9 日期函数
单击“fx”进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“日期”下方,是Axure RP 8的日期函数,如表5-11所示。
表5-11 Axure RP 8日期函数

(续)

5.5.10 布尔函数
单击“fx”进入“编辑文本”对话框,然后单击“插入变量或函数”按钮,在函数下拉列表的“布尔”下方,是Axure RP 8的布尔函数,如表5-12所示。
表5-12 Axure RP 8布尔函数
