mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 03:47:37 +03:00
feat(examples): showcase basics of multiwindows feature on api example (#1468)
This commit is contained in:
parent
186deb43d5
commit
5b6c7bb6ee
@ -422,7 +422,7 @@ where
|
||||
},
|
||||
)
|
||||
}
|
||||
WindowUrl::External(url) => (false, url.to_string()),
|
||||
WindowUrl::External(url) => (url.as_str().starts_with("tauri://"), url.to_string()),
|
||||
};
|
||||
|
||||
let attributes = pending.attributes.clone();
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
import { appWindow, WebviewWindow } from "@tauri-apps/api/window";
|
||||
import { open as openDialog } from "@tauri-apps/api/dialog";
|
||||
import { open } from "@tauri-apps/api/shell";
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
unminimize,
|
||||
show,
|
||||
hide,
|
||||
setTransparent,
|
||||
setDecorations,
|
||||
setAlwaysOnTop,
|
||||
setWidth,
|
||||
@ -27,6 +26,8 @@
|
||||
setIcon,
|
||||
} = appWindow;
|
||||
|
||||
export let onMessage;
|
||||
|
||||
let urlValue = "https://tauri.studio";
|
||||
let resizable = true;
|
||||
let maximized = false;
|
||||
@ -69,6 +70,13 @@
|
||||
}).then(setIcon);
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
const webview = new WebviewWindow(Math.random().toString());
|
||||
webview.once('tauri://error', function () {
|
||||
onMessage("Error creating new webview")
|
||||
})
|
||||
}
|
||||
|
||||
$: setResizable(resizable);
|
||||
$: maximized ? maximize() : unmaximize();
|
||||
//$: setTransparent(transparent)
|
||||
@ -174,6 +182,7 @@
|
||||
<input id="url" bind:value={urlValue} />
|
||||
<button class="button" id="open-url"> Open URL </button>
|
||||
</form>
|
||||
<button class="button" on:click={createWindow}>New window</button>
|
||||
|
||||
<style>
|
||||
.flex-row {
|
||||
|
@ -477,7 +477,7 @@ export class WindowManager {
|
||||
const appWindow = new WindowManager()
|
||||
|
||||
export interface WindowOptions {
|
||||
url?: 'app' | string
|
||||
url?: string
|
||||
x?: number
|
||||
y?: number
|
||||
width?: number
|
||||
|
Loading…
Reference in New Issue
Block a user