Przeglądaj źródła

chore: use mockjs in production environment

Pan 5 lat temu
rodzic
commit
ac4865ab2d
1 zmienionych plików z 8 dodań i 4 usunięć
  1. 8 4
      src/main.js

+ 8 - 4
src/main.js

@@ -17,12 +17,16 @@ import '@/permission' // permission control
17
 
17
 
18
 /**
18
 /**
19
  * If you don't want to use mock-server
19
  * If you don't want to use mock-server
20
- * you want to use mockjs for request interception
21
- * you can execute:
20
+ * you want to use MockJs for mock api
21
+ * you can execute: mockXHR()
22
  *
22
  *
23
- * import { mockXHR } from '../mock'
24
- * mockXHR()
23
+ * Currently MockJs will be used in the production environment,
24
+ * please remove it before going online! ! !
25
  */
25
  */
26
+import { mockXHR } from '../mock'
27
+if (process.env.NODE_ENV === 'production') {
28
+  mockXHR()
29
+}
26
 
30
 
27
 // set ElementUI lang to EN
31
 // set ElementUI lang to EN
28
 Vue.use(ElementUI, { locale })
32
 Vue.use(ElementUI, { locale })