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

有个语法疑问 #26

Open
fanmaoyu0871 opened this issue Jul 14, 2016 · 0 comments
Open

有个语法疑问 #26

fanmaoyu0871 opened this issue Jul 14, 2016 · 0 comments

Comments

@fanmaoyu0871
Copy link

var images = ["image!tabbar-icon", "image!tabbar-icon", "image!tabbar-icon"];
var items = [];
for(var i in titles)
{
var item = (
<TabBarIOS.Item
title={titles[i]}
icon={require(images[i])}
onPress={this.select.bind(this, titles[i])}
selected={this.state.tab == titles[i]}>
{pages[i]}
</TabBarIOS.Item>
);
items.push(item);
}

这里icon,如果我写成字符串require('image!tabbar-icon')就没有问题,就像上述代码片段,编译器就会默认我require了一个模块,不知道什么问题。错误如下:
Requiring unknown module 'image!tabbar-icon'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant