如果imgUrl本身带有英文括号,将导致图片无法展示。
如://abc.com/example(1).png
不规范的用法
实际得到 background-image: url(//abc.com/example(1).png),样式无法生效。
<div style={{ backgroundImage: `url(${imgUrl})` }} />
正确用法
实际得到 background-image: url("//abc.com/example(1).png"),样式正常。
<div style={{ backgroundImage: `url("${imgUrl}")` }} />