add tauri-sqlite and guest module
This commit is contained in:
parent
ce8c259d1b
commit
da2f4c5e06
|
@ -14,7 +14,8 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2",
|
"@tauri-apps/api": "^2",
|
||||||
"@tauri-apps/plugin-shell": "^2"
|
"@tauri-apps/plugin-shell": "^2",
|
||||||
|
"@tauri-apps/plugin-sql": "^2.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-static": "^3.0.5",
|
"@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"
|
tauri-plugin-shell = "2"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
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/
|
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||||
mod handlers;
|
mod actions;
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_shell::init())
|
.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!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||||
greetMsg = await invoke("greet", { name });
|
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>
|
</script>
|
||||||
|
|
||||||
<main class="container">
|
<main class="container">
|
||||||
|
@ -31,6 +37,11 @@
|
||||||
<input id="greet-input" placeholder="Enter a name..." bind:value={name} />
|
<input id="greet-input" placeholder="Enter a name..." bind:value={name} />
|
||||||
<button type="submit">Greet</button>
|
<button type="submit">Greet</button>
|
||||||
</form>
|
</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>
|
<p>{greetMsg}</p>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user