| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import { defineStore } from 'pinia'
- import { reactive, ref } from 'vue'
- export const useScreenStore = defineStore('screen',() => {
- const controllerData = reactive({})
- let placeList = []
- const tunnelList = reactive([])
- const currentTunnel = ref({})
- const setController = (val) => {
- Object.assign(controllerData, val)
- }
- const setTunnelList = (val) => {
- placeList.length = 0;
- val.list.forEach(item => {
- placeList.push({
- styleId: item.ID,
- position: { lat: item.latitude, lng: item.longitude } ,
- })
- })
- tunnelList.length = 0
- tunnelList.push(...val.list)
- }
- const setCurrentTunnel = (val) => {
- currentTunnel.value = val
- console.log('执行2', currentTunnel.value)
- }
- return {
- controllerData,
- setController,
- tunnelList,
- setTunnelList,
- placeList,
- currentTunnel,
- setCurrentTunnel
- }
- })
|