add tauri-sqlite and guest module
This commit is contained in:
parent
ce8c259d1b
commit
da2f4c5e06
|
@ -14,7 +14,8 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2",
|
||||
"@tauri-apps/plugin-shell": "^2"
|
||||
"@tauri-apps/plugin-shell": "^2",
|
||||
"@tauri-apps/plugin-sql": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-static": "^3.0.5",
|
||||
|
|
753
src-tauri/Cargo.lock
generated
753
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
|
@ -22,4 +22,5 @@ tauri = { version = "2", features = [] }
|
|||
tauri-plugin-shell = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tauri-plugin-sql = "2.2.0"
|
||||
|
||||
|
|
9
src-tauri/src/actions.rs
Normal file
9
src-tauri/src/actions.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#[tauri::command]
|
||||
pub fn wave(name: &str) -> String {
|
||||
format!("Hello, {}! You've been waved from Rust, with a different file!", name)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust, with a different file!", name)
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
#[tauri::command]
|
||||
pub fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust, with a different file!", name)
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
mod handlers;
|
||||
mod actions;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.invoke_handler(tauri::generate_handler![handlers::greet])
|
||||
.plugin(tauri_plugin_sql::Builder::default().build())
|
||||
.invoke_handler(tauri::generate_handler![actions::greet, actions::wave])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
greetMsg = await invoke("greet", { name });
|
||||
}
|
||||
|
||||
async function wave(event: Event) {
|
||||
event.preventDefault();
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
greetMsg = await invoke("wave", { name });
|
||||
}
|
||||
</script>
|
||||
|
||||
<main class="container">
|
||||
|
@ -31,6 +37,11 @@
|
|||
<input id="greet-input" placeholder="Enter a name..." bind:value={name} />
|
||||
<button type="submit">Greet</button>
|
||||
</form>
|
||||
|
||||
<form class="row" onsubmit={wave}>
|
||||
<input id="greet-input" placeholder="Enter a name..." bind:value={name} />
|
||||
<button type="submit">Wave</button>
|
||||
</form>
|
||||
<p>{greetMsg}</p>
|
||||
</main>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user