Browse Source

添加头部插入元素控制

code4eat 1 năm trước cách đây
mục cha
commit
3b6c40c51a
1 tập tin đã thay đổi với 11 bổ sung7 xóa
  1. 11 7
      plugin.ts

+ 11 - 7
plugin.ts

@@ -2,20 +2,24 @@
  * @Author: code4eat awesomedema@gmail.com
  * @Date: 2023-12-11 17:09:15
  * @LastEditors: code4eat awesomedema@gmail.com
- * @LastEditTime: 2023-12-11 17:47:14
+ * @LastEditTime: 2023-12-11 17:54:59
  * @FilePath: /kcim-frontend-template/plugin.ts
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */
 import { IApi } from "@umijs/max";
 
+const { REACT_APP_ENV } = process.env;
+
 export default (api: IApi) => {
   api.modifyHTML(($:any) => {
-    $('head').append([
-      `<link rel="icon" href="/favicon.ico" type="image/x-icon">`,
-    ]);
-    $('body').prepend([
-      `<div style="height:48px;background: #3377FF;position: relative;z-index: 99;line-height: 48px;color: white;padding: 0 16px;font-size: 20px;">Header</div>`,
-    ]); 
+    if(REACT_APP_ENV == 'dev'){
+      $('head').append([
+        `<link rel="icon" href="/favicon.ico" type="image/x-icon">`,
+      ]);
+      $('body').prepend([
+        `<div style="height:48px;background: #3377FF;position: relative;z-index: 99;line-height: 48px;color: white;padding: 0 16px;font-size: 20px;">Header</div>`,
+      ]); 
+    }
     return $; 
   });
 };