shaogen1995 1 år sedan
förälder
incheckning
afeb4b49a8
2 ändrade filer med 25 tillägg och 1 borttagningar
  1. 24 0
      code/README.md
  2. 1 1
      code/src/utils/history.ts

+ 24 - 0
code/README.md

@@ -1,3 +1,27 @@
 本地运行:静态资源里面先运行一个服务 
 使用 http-server
 确保服务地址是:http://127.0.0.1:8080
+
+
+-------------------
+
+------ts版本类型问题-------
+
+找到 import { useDispatch } from "react-redux";
+
+按住 Ctrl 点击 useDispatch 出来 useDispatch.d.ts类型声明文件
+(路径node_modules>react-redux>es>hooks>useDispatch.d.ts)
+
+找到最后面的 AnyAction,按住 Ctrl 点击 进入
+(路径node_modules>redux>index.d.ts)
+
+找到
+export interface Action<T = any> {
+  type: T
+}
+
+在type后面加一个 ?   即=>
+
+export interface Action<T = any> {
+  type?: T
+}

+ 1 - 1
code/src/utils/history.ts

@@ -27,7 +27,7 @@ export const isMobileFu = () => {
   } else return false;
 };
 
-// 当前环境是测试环境还是生产环境
+// 当前环境是 本地环境 还是 服务器环境
 const isProduction = process.env.NODE_ENV === "development";
 
 export const isEnvUrl = isProduction ? "https://sit-kpbwg.4dage.com" : "";