element_callMethod
Invokes a method on a custom component instance identified by a selector and returns the serialized result. Use for calling component methods during WeChat mini program debugging.
Instructions
调用自定义组件实例的方法(element.callMethod()),返回该方法的返回值(序列化后放在 result)。仅对自定义组件实例有效,普通 WXML 元素会失败;调用页面级方法请用 page_callMethod。读/写组件实例数据用 element_getData / element_setData。method:方法名;args:按顺序展开传入方法的参数数组。要定位嵌套在外层组件内的组件,用 selector + innerSelector。selector 支持 [index=N](仅作用于 selector)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | ||
| method | 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 |