use-scene.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {
  2. WorkspaceAddDatas,
  3. SceneListType,
  4. GetListWorkshop,
  5. getSceneList,
  6. LabelModuleListType,
  7. } from '@/api/scene/sceneOperate';
  8. import { WorkShopTempleteType } from '@/api/scene/secene-templet';
  9. import { defineStore } from 'pinia';
  10. import { ref } from 'vue';
  11. // export function useScene() {
  12. // //场景数据
  13. // const tableData = ref<
  14. // SceneListType<GetListWorkshop<WorkspaceAddDatas, WorkShopTempleteType>, LabelModuleListType>[]
  15. // >([]);
  16. // const getSceneDetail = () => {
  17. // getSceneList().then((res) => {
  18. // tableData.value = res;
  19. // });
  20. // };
  21. // return { tableData, getSceneDetail };
  22. // }
  23. export const useScene = defineStore('scene-data', () => {
  24. //场景数据
  25. const tableData = ref<
  26. SceneListType<GetListWorkshop<WorkspaceAddDatas, WorkShopTempleteType>, LabelModuleListType>[]
  27. >([]);
  28. const getSceneDetail = () => {
  29. getSceneList().then((res) => {
  30. tableData.value = res;
  31. });
  32. };
  33. return { tableData, getSceneDetail };
  34. });
  35. export default useScene;