From 4e00b279130b46483f7a4d8a377d7d4eb45314f1 Mon Sep 17 00:00:00 2001 From: situ2001 Date: Tue, 22 Apr 2025 00:15:14 +0800 Subject: [PATCH] docs: update example for in webview ts api (#13272) --- packages/api/src/webview.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/api/src/webview.ts b/packages/api/src/webview.ts index da31a72eb..6a2857995 100644 --- a/packages/api/src/webview.ts +++ b/packages/api/src/webview.ts @@ -108,11 +108,23 @@ export type WebviewLabel = string * * // loading embedded asset: * const webview = new Webview(appWindow, 'theUniqueLabel', { - * url: 'path/to/page.html' + * url: 'path/to/page.html', + * + * // create a webview with specific logical position and size + * x: 0, + * y: 0, + * width: 800, + * height: 600, * }); * // alternatively, load a remote URL: * const webview = new Webview(appWindow, 'theUniqueLabel', { * url: 'https://github.com/tauri-apps/tauri' + * + * // create a webview with specific logical position and size + * x: 0, + * y: 0, + * width: 800, + * height: 600, * }); * * webview.once('tauri://created', function () { @@ -148,7 +160,13 @@ class Webview { * import { Webview } from '@tauri-apps/api/webview' * const appWindow = new Window('my-label') * const webview = new Webview(appWindow, 'my-label', { - * url: 'https://github.com/tauri-apps/tauri' + * url: 'https://github.com/tauri-apps/tauri', + * + * // create a webview with specific logical position and size + * x: 0, + * y: 0, + * width: 800, + * height: 600, * }); * webview.once('tauri://created', function () { * // webview successfully created