Remove shadcn and add store plugin
This commit is contained in:
@@ -5,8 +5,7 @@ export default defineNuxtConfig({
|
||||
"@nuxt/icon",
|
||||
"@nuxt/fonts",
|
||||
"nuxt-svgo",
|
||||
"@nuxt/eslint",
|
||||
"shadcn-nuxt"
|
||||
"@nuxt/eslint"
|
||||
],
|
||||
app: {
|
||||
head: {
|
||||
@@ -32,9 +31,6 @@ export default defineNuxtConfig({
|
||||
experimental: {
|
||||
typedPages: true
|
||||
},
|
||||
shadcn: {
|
||||
prefix: "ui"
|
||||
},
|
||||
fonts: {
|
||||
defaults: {
|
||||
weights: [`${100}..${900}`]
|
||||
|
@@ -28,7 +28,8 @@
|
||||
"@tauri-apps/plugin-fs": "^2.0.0",
|
||||
"@tauri-apps/plugin-notification": "^2.0.0",
|
||||
"@tauri-apps/plugin-os": "^2.0.0",
|
||||
"@tauri-apps/plugin-shell": "^2.0.0"
|
||||
"@tauri-apps/plugin-shell": "^2.0.0",
|
||||
"@tauri-apps/plugin-store": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^3.7.3",
|
||||
@@ -44,7 +45,6 @@
|
||||
"nuxt": "^3.13.2",
|
||||
"nuxt-svgo": "^4.0.6",
|
||||
"sass": "^1.79.4",
|
||||
"shadcn-nuxt": "^0.10.4",
|
||||
"typescript": "^5.6.3"
|
||||
}
|
||||
}
|
||||
|
31
pnpm-lock.yaml
generated
31
pnpm-lock.yaml
generated
@@ -26,6 +26,9 @@ importers:
|
||||
'@tauri-apps/plugin-shell':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
'@tauri-apps/plugin-store':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
devDependencies:
|
||||
'@antfu/eslint-config':
|
||||
specifier: ^3.7.3
|
||||
@@ -66,9 +69,6 @@ importers:
|
||||
sass:
|
||||
specifier: ^1.79.4
|
||||
version: 1.79.4
|
||||
shadcn-nuxt:
|
||||
specifier: ^0.10.4
|
||||
version: 0.10.4(magicast@0.3.5)(rollup@4.18.0)(webpack-sources@3.2.3)
|
||||
typescript:
|
||||
specifier: ^5.6.3
|
||||
version: 5.6.3
|
||||
@@ -1445,9 +1445,6 @@ packages:
|
||||
resolution: {integrity: sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@oxc-parser/wasm@0.1.0':
|
||||
resolution: {integrity: sha512-oA7XhTbg9rRBJhIzxCNhJwYmON/9LFAH4GBQxl7HWmGSS6HTrb2t6Peq82nxY0W7knguH52neh9T7zs27FVvsQ==}
|
||||
|
||||
'@parcel/watcher-android-arm64@2.4.1':
|
||||
resolution: {integrity: sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
@@ -1909,6 +1906,9 @@ packages:
|
||||
'@tauri-apps/plugin-shell@2.0.0':
|
||||
resolution: {integrity: sha512-OpW2+ycgJLrEoZityWeWYk+6ZWP9VyiAfbO+N/O8VfLkqyOym8kXh7odKDfINx9RAotkSGBtQM4abyKfJDkcUg==}
|
||||
|
||||
'@tauri-apps/plugin-store@2.0.0':
|
||||
resolution: {integrity: sha512-l4xsbxAXrKGdBdYNNswrLfcRv3v1kOatdycOcVPYW+jKwkznCr1HEOrPXkPhXsZLSLyYmNXpgfOmdSZNmcykDg==}
|
||||
|
||||
'@trysound/sax@0.2.0':
|
||||
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
@@ -4832,9 +4832,6 @@ packages:
|
||||
setprototypeof@1.2.0:
|
||||
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
|
||||
|
||||
shadcn-nuxt@0.10.4:
|
||||
resolution: {integrity: sha512-WhSGzjaSMi1D2xb9Aflpwl8G8Qvlb0g4OuJLPO4YyRhduQDuscU6Pr1HdF7T4700foLLglgFnz7m8E2DDLLHJA==}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -7096,8 +7093,6 @@ snapshots:
|
||||
|
||||
'@opentelemetry/semantic-conventions@1.25.1': {}
|
||||
|
||||
'@oxc-parser/wasm@0.1.0': {}
|
||||
|
||||
'@parcel/watcher-android-arm64@2.4.1':
|
||||
optional: true
|
||||
|
||||
@@ -7442,6 +7437,10 @@ snapshots:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.2
|
||||
|
||||
'@tauri-apps/plugin-store@2.0.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.2
|
||||
|
||||
'@trysound/sax@0.2.0': {}
|
||||
|
||||
'@types/debug@4.1.12':
|
||||
@@ -11206,16 +11205,6 @@ snapshots:
|
||||
|
||||
setprototypeof@1.2.0: {}
|
||||
|
||||
shadcn-nuxt@0.10.4(magicast@0.3.5)(rollup@4.18.0)(webpack-sources@3.2.3):
|
||||
dependencies:
|
||||
'@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.18.0)(webpack-sources@3.2.3)
|
||||
'@oxc-parser/wasm': 0.1.0
|
||||
transitivePeerDependencies:
|
||||
- magicast
|
||||
- rollup
|
||||
- supports-color
|
||||
- webpack-sources
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
|
33
src-tauri/Cargo.lock
generated
33
src-tauri/Cargo.lock
generated
@@ -2061,7 +2061,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2333,7 +2333,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nuxtor"
|
||||
version = "0.0.4"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -2343,6 +2343,7 @@ dependencies = [
|
||||
"tauri-plugin-notification",
|
||||
"tauri-plugin-os",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-store",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3867,6 +3868,22 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-store"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5058f179f7215390fc5a68eeffcb805b7e2681d6e817a5d08094fae7ab649e68"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.0.1"
|
||||
@@ -4072,9 +4089,21 @@ dependencies = [
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.11"
|
||||
|
@@ -24,6 +24,7 @@ tauri-plugin-shell = "2.0.1"
|
||||
tauri-plugin-notification = "2.0.1"
|
||||
tauri-plugin-os = "2.0.1"
|
||||
tauri-plugin-fs = "2.0.1"
|
||||
tauri-plugin-store = "2.0.1"
|
||||
serde_json = "1"
|
||||
|
||||
[dependencies.tauri]
|
||||
|
@@ -37,6 +37,7 @@
|
||||
"os:allow-version",
|
||||
"os:allow-locale",
|
||||
"fs:allow-document-read",
|
||||
"fs:allow-document-write"
|
||||
"fs:allow-document-write",
|
||||
"store:default"
|
||||
]
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{ "main": { "identifier": "main", "description": "Capabilities for the main window", "local": true, "windows": ["main"], "permissions": ["core:path:default", "core:event:default", "core:window:default", "core:app:default", "core:resources:default", "core:menu:default", "core:tray:default", "shell:allow-open", { "identifier": "shell:allow-execute", "allow": [{ "args": ["-c", { "validator": "\\S+" }], "cmd": "sh", "name": "exec-sh", "sidecar": false }] }, "notification:default", "os:allow-platform", "os:allow-arch", "os:allow-family", "os:allow-version", "os:allow-locale", "fs:allow-document-read", "fs:allow-document-write"] } }
|
||||
{"main":{"identifier":"main","description":"Capabilities for the main window","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},"notification:default","os:allow-platform","os:allow-arch","os:allow-family","os:allow-version","os:allow-locale","fs:allow-document-read","fs:allow-document-write","store:default"]}}
|
@@ -5091,6 +5091,141 @@
|
||||
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "shell:deny-stdin-write"
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
||||
"type": "string",
|
||||
"const": "store:default"
|
||||
},
|
||||
{
|
||||
"description": "Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-clear"
|
||||
},
|
||||
{
|
||||
"description": "Enables the create_store command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-create-store"
|
||||
},
|
||||
{
|
||||
"description": "Enables the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-delete"
|
||||
},
|
||||
{
|
||||
"description": "Enables the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-entries"
|
||||
},
|
||||
{
|
||||
"description": "Enables the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-get"
|
||||
},
|
||||
{
|
||||
"description": "Enables the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-has"
|
||||
},
|
||||
{
|
||||
"description": "Enables the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-keys"
|
||||
},
|
||||
{
|
||||
"description": "Enables the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-length"
|
||||
},
|
||||
{
|
||||
"description": "Enables the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-load"
|
||||
},
|
||||
{
|
||||
"description": "Enables the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-reset"
|
||||
},
|
||||
{
|
||||
"description": "Enables the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-save"
|
||||
},
|
||||
{
|
||||
"description": "Enables the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-set"
|
||||
},
|
||||
{
|
||||
"description": "Enables the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-values"
|
||||
},
|
||||
{
|
||||
"description": "Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-clear"
|
||||
},
|
||||
{
|
||||
"description": "Denies the create_store command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-create-store"
|
||||
},
|
||||
{
|
||||
"description": "Denies the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-delete"
|
||||
},
|
||||
{
|
||||
"description": "Denies the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-entries"
|
||||
},
|
||||
{
|
||||
"description": "Denies the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-get"
|
||||
},
|
||||
{
|
||||
"description": "Denies the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-has"
|
||||
},
|
||||
{
|
||||
"description": "Denies the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-keys"
|
||||
},
|
||||
{
|
||||
"description": "Denies the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-length"
|
||||
},
|
||||
{
|
||||
"description": "Denies the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-load"
|
||||
},
|
||||
{
|
||||
"description": "Denies the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-reset"
|
||||
},
|
||||
{
|
||||
"description": "Denies the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-save"
|
||||
},
|
||||
{
|
||||
"description": "Denies the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-set"
|
||||
},
|
||||
{
|
||||
"description": "Denies the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-values"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -5091,6 +5091,141 @@
|
||||
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "shell:deny-stdin-write"
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
||||
"type": "string",
|
||||
"const": "store:default"
|
||||
},
|
||||
{
|
||||
"description": "Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-clear"
|
||||
},
|
||||
{
|
||||
"description": "Enables the create_store command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-create-store"
|
||||
},
|
||||
{
|
||||
"description": "Enables the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-delete"
|
||||
},
|
||||
{
|
||||
"description": "Enables the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-entries"
|
||||
},
|
||||
{
|
||||
"description": "Enables the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-get"
|
||||
},
|
||||
{
|
||||
"description": "Enables the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-has"
|
||||
},
|
||||
{
|
||||
"description": "Enables the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-keys"
|
||||
},
|
||||
{
|
||||
"description": "Enables the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-length"
|
||||
},
|
||||
{
|
||||
"description": "Enables the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-load"
|
||||
},
|
||||
{
|
||||
"description": "Enables the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-reset"
|
||||
},
|
||||
{
|
||||
"description": "Enables the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-save"
|
||||
},
|
||||
{
|
||||
"description": "Enables the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-set"
|
||||
},
|
||||
{
|
||||
"description": "Enables the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-values"
|
||||
},
|
||||
{
|
||||
"description": "Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-clear"
|
||||
},
|
||||
{
|
||||
"description": "Denies the create_store command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-create-store"
|
||||
},
|
||||
{
|
||||
"description": "Denies the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-delete"
|
||||
},
|
||||
{
|
||||
"description": "Denies the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-entries"
|
||||
},
|
||||
{
|
||||
"description": "Denies the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-get"
|
||||
},
|
||||
{
|
||||
"description": "Denies the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-has"
|
||||
},
|
||||
{
|
||||
"description": "Denies the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-keys"
|
||||
},
|
||||
{
|
||||
"description": "Denies the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-length"
|
||||
},
|
||||
{
|
||||
"description": "Denies the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-load"
|
||||
},
|
||||
{
|
||||
"description": "Denies the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-reset"
|
||||
},
|
||||
{
|
||||
"description": "Denies the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-save"
|
||||
},
|
||||
{
|
||||
"description": "Denies the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-set"
|
||||
},
|
||||
{
|
||||
"description": "Denies the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-values"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -31,6 +31,7 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
@@ -24,6 +24,9 @@
|
||||
<NavLink to="/file">
|
||||
File
|
||||
</NavLink>
|
||||
<NavLink to="/store">
|
||||
Store
|
||||
</NavLink>
|
||||
</div>
|
||||
<div hidden lg="flex flex-1 justify-end">
|
||||
<p text-sm text-white font-semibold leading-6>
|
||||
|
@@ -3,6 +3,7 @@ import * as tauriFs from "@tauri-apps/plugin-fs";
|
||||
import * as tauriNotification from "@tauri-apps/plugin-notification";
|
||||
import * as tauriOs from "@tauri-apps/plugin-os";
|
||||
import * as tauriShell from "@tauri-apps/plugin-shell";
|
||||
import * as tauriStore from "@tauri-apps/plugin-store";
|
||||
import { addImports, defineNuxtModule } from "nuxt/kit";
|
||||
|
||||
const capitalize = (name: string) => {
|
||||
@@ -14,7 +15,8 @@ const tauriModules = [
|
||||
{ module: tauriShell, prefix: "Shell", importPath: "@tauri-apps/plugin-shell" },
|
||||
{ module: tauriOs, prefix: "Os", importPath: "@tauri-apps/plugin-os" },
|
||||
{ module: tauriNotification, prefix: "Notification", importPath: "@tauri-apps/plugin-notification" },
|
||||
{ module: tauriFs, prefix: "Fs", importPath: "@tauri-apps/plugin-fs" }
|
||||
{ module: tauriFs, prefix: "Fs", importPath: "@tauri-apps/plugin-fs" },
|
||||
{ module: tauriStore, prefix: "Store", importPath: "@tauri-apps/plugin-store" },
|
||||
];
|
||||
|
||||
export default defineNuxtModule<ModuleOptions>({
|
||||
|
62
src/pages/store.vue
Normal file
62
src/pages/store.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<LayoutTile
|
||||
title="Store"
|
||||
description="Persistent key-value store. Allows you to handle state to a file which can be saved and loaded on demand including between app restarts."
|
||||
>
|
||||
<form @submit.prevent="setStoreValue()">
|
||||
<div mx-auto max-w-xl lg="mr-0 max-w-lg">
|
||||
<div grid grid-cols-1 gap-x-8 gap-y-6>
|
||||
<div>
|
||||
<label for="store-value" block text-sm text-white font-semibold leading-6>Store value</label>
|
||||
<div mt="2.5">
|
||||
<input id="store-value" v-model="input" type="text" name="store-value" block w-full border-0 rounded-md bg="white/5" px="3.5" py-2 text-white shadow-sm ring-1 ring="white/10" ring-inset sm="text-sm leading-6" focus="ring-2 ring-emerald-500 ring-inset">
|
||||
</div>
|
||||
</div>
|
||||
<div flex justify-end>
|
||||
<Btn type="submit">
|
||||
Send command
|
||||
</Btn>
|
||||
</div>
|
||||
<div mt-8>
|
||||
<label for="store-data" block text-sm text-white font-semibold leading-6>Current Store data</label>
|
||||
<div mt="2.5">
|
||||
<textarea id="store-data" v-model="result" name="store-data" rows="10" block w-full border-0 rounded-md bg="white/5" px="3.5" py-2 text-white shadow-sm ring-1 ring="white/10" ring-inset sm="text-sm leading-6" focus="ring-2 ring-emerald-500 ring-inset" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</LayoutTile>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const input = ref("");
|
||||
const result = ref("");
|
||||
const autosave = ref(false);
|
||||
|
||||
const store = await useTauriStoreCreateStore("store.bin", {
|
||||
autosave: autosave.value
|
||||
});
|
||||
|
||||
const getStoreValue = async () => {
|
||||
try {
|
||||
result.value = await store.get<string>("myData");
|
||||
} catch (error) {
|
||||
result.value = JSON.stringify(error, null, 4);
|
||||
}
|
||||
};
|
||||
|
||||
await getStoreValue();
|
||||
|
||||
const setStoreValue = async () => {
|
||||
try {
|
||||
await store.set("myData", input.value);
|
||||
|
||||
await getStoreValue();
|
||||
} catch (error) {
|
||||
result.value = JSON.stringify(error, null, 4);
|
||||
} finally {
|
||||
input.value = "";
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user