主题
OpenUrl 继承自: ClientAction
在控件被激活时打开一个 URL。
它等同于 launch_url,但由客户端在用户的手势操作内执行,因此打开新标签页时不会被当作 非主动请求的弹窗而拦截。
Example: python ft.Button( "Open flet.dev", action=ft.OpenUrl("https://flet.dev", target=ft.UrlTarget.BLANK), )
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
url | str | action_ | 要打开的 URL。 |
target | Optional[Union[UrlTarget, str]] | action_None | Where to open the URL, for example BLANK for a new tab. Web-only; ignored on other platforms. |
service_id | int | 0 | Internal id of the service that performs this action on the client. |
method | str | '' | Name of the service method invoked on the client. |
args | dict[str, Any] | {} | Arguments passed to method. |