element_getStyles
Retrieve computed CSS style values of elements in WeChat mini programs. Specify selectors and style property names to get targeted styling information.
Instructions
读取元素的计算样式值(element.style(name))。names 为样式名数组,用 camelCase(如 ['color','fontSize','backgroundColor']);单个读不到的名返回 null,全部读取失败则报错。结果超过 maxBytes(默认 50000B)会截断。要读自定义组件内部元素的样式,用 selector 定位组件、innerSelector 定位内部元素。selector 支持 [index=N](仅作用于 selector)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| names | Yes | ||
| maxBytes | No | ||
| selector | Yes | ||
| connection | No | 可选连接覆盖(不传则用默认会话)。可用字段:mode(launch|connect)、cliPath、projectPath、wsEndpoint、timeout、port(【自动化端口】→ cli auto --auto-port,默认 9420;不是 IDE HTTP 服务端口,别把 IDE 服务端口传进来)、account、ticket、trustProject、args、cwd、autoClose、autoLaunch、launchTimeout、connectTimeout。 | |
| innerSelector | No |