We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H5
浏览器版本: chrome 87 使用框架: React
const ImgWrap = memo(props => { const { src } = props; const [currentSrc, setCurrentSrc] = useState(src); const handleError = useCallback(() => { setCurrentSrc('默认图片.jpg'); }, [ ]); return <Image id={currentSrc} onError={handleError} src={currentSrc} />; });
<ImgWrap src='错误图片.jpg' />
<taro-image-core id="默认图片.jpg" > <img class="taro-img__mode-scaletofill" src="错误图片.jpg"> </taro-image-core>
onError 后,可以正常重新设置 src
onError 后,重新设置 src 失败,但实际src已经改变(例子中id已经变了)
Taro CLI 3.0.16 environment info: System: OS: macOS 10.14.6 Shell: 5.3 - /bin/zsh Binaries: Node: 12.18.4 - ~/.nvm/versions/node/v12.18.4/bin/node npm: 6.14.6 - ~/.nvm/versions/node/v12.18.4/bin/npm npmPackages: @tarojs/cli: ^3.0.16 => 3.0.16 @tarojs/components: 3.0.16 => 3.0.16 @tarojs/mini-runner: 3.0.16 => 3.0.16 @tarojs/react: 3.0.16 => 3.0.16 @tarojs/runtime: 3.0.16 => 3.0.16 @tarojs/taro: 3.0.16 => 3.0.16 @tarojs/webpack-runner: 3.0.16 => 3.0.16 babel-preset-taro: 3.0.16 => 3.0.16 eslint-config-taro: 3.0.16 => 3.0.16 react: ^16.10.0 => 16.14.0
The text was updated successfully, but these errors were encountered:
去掉memo或者useCallback
memo
useCallback
Sorry, something went wrong.
并没有用
是lazyload的问题,要为false才能动态改变
No branches or pull requests
相关平台
H5
浏览器版本: chrome 87
使用框架: React
复现步骤
期望结果
onError 后,可以正常重新设置 src
实际结果
onError 后,重新设置 src 失败,但实际src已经改变(例子中id已经变了)
环境信息
The text was updated successfully, but these errors were encountered: