You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haoliang-net/frontend/src/composables/useMockPath.ts

9 lines
315 B
TypeScript

// 提供统一的 Mock 路径前缀判断与路径构建 helpers
export function useMockPath() {
const isMock = typeof window !== 'undefined' && window.location.pathname.startsWith('/mock')
function mockPath(path: string): string {
return isMock ? `/mock${path}` : path
}
return { isMock, mockPath }
}