inleft
2022-02-23 81c155e7e00b83f06e6486a8d904428a44b8b275
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
function isIE() {
    const bw = window.navigator.userAgent
    const compare = (s) => bw.indexOf(s) >= 0
    const ie11 = (() => 'ActiveXObject' in window)()
    return compare('MSIE') || ie11
}
// 判断环境不是 prod 或者 preview 是 true 时,加载 mock 服务
if (process.env.NODE_ENV !== 'production' || process.env.VUE_APP_PREVIEW === 'true') {
    if (isIE()) {
        console.error('[antd-pro] ERROR: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.')
    }
    // 使用同步加载依赖
    // 防止 vuex 中的 GetInfo 早于 mock 运行,导致无法 mock 请求返回结果
    console.log('[antd-pro] mock mounting')
    const Mock = require('mockjs2')
    // require('./services/auth')
    // require('./services/user')
    // require('./services/manage')
    // require('./services/other')
    // require('./services/tagCloud')
    // require('./test/article.js')
 
    Mock.setup({
        timeout: 800 // setter delay time
    })
    console.log('[antd-pro] mock mounted')
}