30 lines
605 B
TypeScript
30 lines
605 B
TypeScript
import { defineStore, createPinia } from "pinia"
|
|
// import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
|
|
|
|
// 定义 MapViewdata 的类型
|
|
interface MapViewdata {
|
|
Mapswitch: boolean;
|
|
}
|
|
|
|
export const MapViewdata = defineStore({
|
|
id: "MapViewdata",
|
|
|
|
// 数据
|
|
state: (): MapViewdata => ({
|
|
Mapswitch: true
|
|
}),
|
|
|
|
// 方法
|
|
actions: {
|
|
async toggleMapSwitch() {
|
|
this.Mapswitch = !this.Mapswitch;
|
|
}
|
|
}
|
|
|
|
})
|
|
|
|
// piniaPersist(持久化)
|
|
// const pinia = createPinia();
|
|
// pinia.use(piniaPluginPersistedstate);
|
|
|
|
// export default pinia;
|