2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-10-17 03:59:02 +00:00

chore: update example for webview

This commit is contained in:
Jan Laupetin
2025-10-03 12:06:34 +01:00
parent 804e6cf1cd
commit 026d5e3dfa
3 changed files with 15 additions and 7 deletions

View File

@@ -1,18 +1,18 @@
<script setup lang="ts">
import { ref } from "vue";
import { nativeMethods } from "./native";
const greetMsg = ref("");
const name = ref("");
async function greet() {
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
// greetMsg.value = await invoke("greet", { name: name.value });
greetMsg.value = await nativeMethods.greet(name.value);
}
</script>
<template>
<main class="container">
<h1>Welcome to Tauri + Vue</h1>
<h1>Welcome to Webview + Vue</h1>
<form class="row" @submit.prevent="greet">
<input id="greet-input" v-model="name" placeholder="Enter a name..." autocomplete="off" />

View File

@@ -0,0 +1,7 @@
export interface NativeMethods{
greet: (name: string) => Promise<string>;
}
// @ts-expect-error
export const nativeMethods: NativeMethods = window as NativeMethods;