docs.rs failed to build tauri-plugin-pinia-0.1.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
tauri-plugin-pinia-5.0.0
tauri-plugin-pinia
Persistent Pinia stores for Tauri, with automatic synchronization between multiple windows.
Install
Install the plugin by adding the following to your Cargo.toml file:
[]
= 0.1
Install the JavaScript package with your preferred package manager:
# or
# or
Usage
- Enable the required permissions in your capabilities file:
- Register the plugin with Tauri:
src-tauri/src/main.rs
- Enable the plugin for Pinia:
src/index.ts
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import { TauriPluginPinia } from 'tauri-plugin-pinia';
const app = createApp(App);
const pinia = createPinia();
pinia.use(TauriPluginPinia);
app.use(pinia);
app.mount('#app');
- Create your Pinia store:
src/stores/counter.ts
import { ref } from 'vue';
import { defineStore } from 'pinia';
export const useCounterStore = defineStore('counter', () => {
const counter = ref(0);
function increment() {
counter.value++;
}
function decrement() {
counter.value--;
}
return {
counter,
increment,
decrement
};
});
- Start the plugin!
import { useCounterStore } from './stores/counter';
const counterStore = useCounterStore();
counterStore.$tauri.start();