问题描述
小程序环境下。
引入图片时,如果在map循环中,则import进来的本地图片无法显示,渲染结果src=""。
如果将代码移出map循环,图片可正常显示。
例如:
import noticeBackground from "./[email protected]";
export class Notice extends Component {
render() {
return (
<Swiper className='notice-swiper' autoplay vertical circular>
{
[1,2,3].map((item, index) => (
<SwiperItem className='notice-swiper-item' key={index}>
<View className='notice'>
<Image className='background' src={noticeBackground} />
</View>
</SwiperItem>
))
}
</Swiper>
)
}
}
系统信息
请问换一张网络的图片可以吗
@yuche 用网络图片可以正常显示。
那暂时使用网络图片吧。
现在循环中只能使用 class 作用域的变量,目前的版本不打算修复这个问题了,v0.1.0 会对组件化进行重构,循环的逻辑会简单很多。应该本周应该能出来。
最新的 beta 版本已经修复此问题~
Most helpful comment
那暂时使用网络图片吧。
现在循环中只能使用 class 作用域的变量,目前的版本不打算修复这个问题了,
v0.1.0会对组件化进行重构,循环的逻辑会简单很多。应该本周应该能出来。