Files
2026-09-24 16:25:22 +08:00

18 lines
653 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 数据请求层(当前为 mock
* ------------------------------------------------------------
* 全局统一模拟 1s 的请求耗时;请求返回前列表页应展示 xSkeleton 骨架屏。
* 后续对接真实接口时,只需把 mockRequest 的实现换成 uni.request 封装,
* 页面层(loading 开关 + 骨架屏)完全不用改。
*/
/** 统一模拟请求时长(ms) */
export const MOCK_REQUEST_DELAY : number = 1000
/** 模拟一次数据请求:delay 后回调 onDone */
export function mockRequest(onDone : () => void, delay : number = MOCK_REQUEST_DELAY) : void {
setTimeout(() => {
onDone()
}, delay)
}