docs: update example for in webview ts api (#13272)

This commit is contained in:
situ2001
2025-04-22 00:15:14 +08:00
committed by GitHub
parent 766bccc341
commit 4e00b27913

View File

@@ -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