Skip to content

Commit 2321bd4

Browse files
authored
fix(templates): fix blazor onsubmit and js module import (#734)
closes #724
1 parent d4d8018 commit 2321bd4

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

.changes/blazor-on-submit.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"create-tauri-app": "patch"
3+
"create-tauri-app-js": "patch"
4+
---
5+
6+
Fix `blazor` template `onsubmit` handler.
7+

templates/template-blazor/src/Pages/Home.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<div class="container">
55
<h1>Welcome to Tauri!</h1>
6-
6+
77
<div class="row">
88
<a href="https://tauri.app" target="_blank">
99
<img src="img/tauri.svg" class="logo tauri" alt="Tauri logo"/>
@@ -15,7 +15,7 @@
1515

1616
<p>Click on the Tauri and Blazor logos to learn more.</p>
1717

18-
<form class="row" @submit="GreetAsync" @submit:preventDefault="true">
18+
<form class="row" @onsubmit="GreetAsync" @onsubmit:preventDefault="true">
1919
<input id="greet-input" placeholder="Enter a name..." @bind="GreetInput"/>
2020
<button type="submit">Greet</button>
2121
</form>
@@ -31,6 +31,6 @@
3131

3232
private async Task GreetAsync()
3333
{
34-
GreetMsg = await JsRuntime.InvokeAsync<string>("__TAURI__.tauri.invoke", "greet", new { name = GreetInput });
34+
GreetMsg = await JsRuntime.InvokeAsync<string>("__TAURI__.{% if beta %}core{% else %}tauri{% endif %}.invoke", "greet", new { name = GreetInput });
3535
}
3636
}

0 commit comments

Comments
 (0)