feat: 增加获取位置的方法
This commit is contained in:
@@ -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 };
|
||||
19
src/store/modules/location.js
Normal file
19
src/store/modules/location.js
Normal 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,
|
||||
});
|
||||
Reference in New Issue
Block a user