34 lines
760 B
TypeScript
34 lines
760 B
TypeScript
"use client"
|
|
import Image from "next/image";
|
|
import {Greet} from "@/wailsjs/go/main/App";
|
|
import { main } from "@/wailsjs/go/models";
|
|
import {useState} from "react";
|
|
|
|
export default function Home() {
|
|
const [result, setResult] = useState('Please enter your name below 👇')
|
|
const person = new main.Person();
|
|
person.age= 11;
|
|
person.name="dd";
|
|
|
|
return <>
|
|
{result}
|
|
<button
|
|
onClick={() => {
|
|
try {
|
|
Greet(person)
|
|
.then(result => {
|
|
setResult(result)
|
|
|
|
})
|
|
.catch(err => {
|
|
console.error(err)
|
|
})
|
|
} catch (err) {
|
|
console.error(err)
|
|
}
|
|
}}>
|
|
Greet
|
|
</button>
|
|
</>
|
|
}
|