gd-earth/src/stores/flyto.js

26 lines
464 B
JavaScript

import { defineStore } from 'pinia'
import { isLnglat } from '/@/api/util'
export const useFlytoStore = defineStore({
id: 'flyto',
state: () => ({
lng: NaN,
lat: NaN,
change:true,
}),
getters: {
value: (state) => { state.lng, state.lat }
},
actions: {
set(flyto) {
if ( !isLnglat(flyto) ) return false
this.lng = flyto.lng
this.lat = flyto.lat
this.change = !this.change
return true
},
},
})