Skip to content
New issue

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

在map循环中,import进来的本地图片无法显示。 #314

Closed
deepcoldy opened this issue Jul 13, 2018 · 4 comments
Closed

在map循环中,import进来的本地图片无法显示。 #314

deepcoldy opened this issue Jul 13, 2018 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@deepcoldy
Copy link

问题描述
小程序环境下。
引入图片时,如果在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>
    )
  }
}

系统信息

  • 操作系统: mac
  • Taro 版本 v.0.0.69
  • Node.js 版本 v9.11.1
@yuche yuche self-assigned this Jul 14, 2018
@yuche yuche added the bug Something isn't working label Jul 14, 2018
@yuche
Copy link
Contributor

yuche commented Jul 16, 2018

请问换一张网络的图片可以吗

@deepcoldy
Copy link
Author

@yuche 用网络图片可以正常显示。

@yuche
Copy link
Contributor

yuche commented Jul 16, 2018

那暂时使用网络图片吧。

现在循环中只能使用 class 作用域的变量,目前的版本不打算修复这个问题了,v0.1.0 会对组件化进行重构,循环的逻辑会简单很多。应该本周应该能出来。

@luckyadam
Copy link
Member

最新的 beta 版本已经修复此问题~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants