客户

提供对方法的访问权限,以确定正在使用哪个客户端、客户端是否连接到服务器以及正在使用哪种类型的设备。

Syntax

context.client;

适用于

模型驱动应用、画布应用和门户。

属性

disableScroll

禁用组件的滚动功能。 模型驱动和画布应用都支持此属性。

类型boolean

Methods

方法 Description 适用于
getClient 返回一个值,该值指示脚本正在执行哪个客户端。 模型驱动和画布应用
getFormFactor 返回有关用户正在使用的设备类型的信息。 模型驱动和画布应用
isOffline 返回服务器是联机还是脱机的信息。 模型驱动应用
isNetworkAvailable 返回网络是否可用的信息 模型驱动应用

Example

private createHTMLTableElement(): HTMLTableElement {
    let tableElement: HTMLTableElement = document.createElement("table");
    tableElement.setAttribute("class", "SampleControlHtmlTable_HtmlTable");
    let key: string = "Example Method";
    let value: string = "Result";
    tableElement.appendChild(this.createHTMLTableRowElement(key, value, true));
    key = "getFormFactor()";
    value = String(this._context.client.getFormFactor());
    tableElement.appendChild(this.createHTMLTableRowElement(key, value, false));
    key = "getClient()";
    value = String(this._context.client.getClient());
    tableElement.appendChild(this.createHTMLTableRowElement(key, value, false));
}

Power Apps 组件框架 API 参考
Power Apps 组件框架概述