feat 全局系统名称bug

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Ironsp
2026-05-29 11:47:50 +08:00
parent f149fca426
commit d1ed96b8fc
4 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
import { defineStore } from 'pinia';
import { ref, computed } from 'vue';
import { getDevicetList } from '@/api/equipmentList/index';
export const useDeviceStore = defineStore('devices', () => {
// --- State (状态) ---
// 相当于 Vuex 中的 state用 ref 或 reactive 定义
const deviceList = ref();
// --- Getters (计算属性) ---
// 相当于 Vuex 中的 getters直接用 computed 定义
// --- Actions (动作) ---
// 相当于 Vuex 中的 actions/mutations直接写同步或异步函数
async function getdeviceList(query?: any) {
try {
const response = await getDevicetList(query);
console.log('获取设备列表:', response);
deviceList.value = response.data;
} catch (error) {
console.error('获取设备列表失败', error);
}
}
// ⚠️ 核心点:必须把需要暴露出去的变量和方法 return 出去!
return {
deviceList,
getdeviceList
};
});