18 lines
412 B
JavaScript
18 lines
412 B
JavaScript
import { useRoute } from "vue-router";
|
|
import { computed, inject, ref, watch } from "vue";
|
|
|
|
function useSelectedFloor() {
|
|
const { currentFloor } = inject("system_deviceList");
|
|
const route = useRoute();
|
|
const selectedFloor = computed(() =>
|
|
currentFloor.value?.find(({ key }) => key == route.params.floor_id)
|
|
);
|
|
|
|
return {
|
|
selectedFloor,
|
|
currentFloor,
|
|
};
|
|
}
|
|
|
|
export default useSelectedFloor;
|