feat: 增加获取位置的方法

This commit is contained in:
2026-05-08 14:58:13 +08:00
parent a3c82382c2
commit 25c8a3570d
6 changed files with 103 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import { useAppStore } from "./app";
import { useSelectedDateStore } from "./selectedDate";
import { usePictureStore } from "./picture";
import { useLocationStore } from "./location";
export { useAppStore, useSelectedDateStore, usePictureStore };
export { useAppStore, useSelectedDateStore, usePictureStore, useLocationStore };

View File

@@ -0,0 +1,19 @@
import { defineStore } from "pinia";
export const useLocationStore = defineStore("location", {
state() {
return {
latitude: 0, // 纬度
longitude: 0, // 经度
};
},
actions: {
setLocationData(data) {
this.latitude = data.latitude;
this.longitude = data.longitude;
},
},
unistorage: true,
});