const inputRef = useRef(null);
<Input ref={inputRef} />
const { backgroundColor } = getComputedStyle(inputRef.current)
报错如下:
Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
const inputRef = useRef(null);
<Input ref={inputRef} />
const { backgroundColor } = getComputedStyle(inputRef.current)
报错如下:
Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
10 回答11.7k 阅读
2 回答3.2k 阅读✓ 已解决
2 回答4.3k 阅读✓ 已解决
3 回答1.9k 阅读✓ 已解决
2 回答1.7k 阅读✓ 已解决
4 回答2.5k 阅读✓ 已解决
5 回答3.8k 阅读