未分類 26 9 月 2020 各位大佬, axios 异步请求,回调函数获取全局变量为空,怎么解决这个问题啊? 各位大佬, axios 异步请求,回调函数获取全局变量为空,怎么解决这个问题啊? 資深大佬 : qwertty01 0 RT,在线等 大佬有話說 (5) 資深大佬 : liberty1900 Talk is cheap 資深大佬 : SilencerL Show me the fucking code. 主 資深大佬 : qwertty01 @liberty1900 @SilencerL 麻烦大佬帮忙看一下 資深大佬 : Danswerme 你这是要拿到 ref ? 函数式组件的话可以用 useRefimport { useRef } from “react”;… let growl = useRef(null); 文档见此 https://zh-hans.reactjs.org/docs/hooks-reference.html#useref 另外你 then 里面的 const.log 是什么玩意? 主 資深大佬 : qwertty01 @Danswerme 多谢大佬指点,ref 这块一直没太学明白。