我了解到,为了在本机反应中添加静态图像资源,必须静态知道图像。这是通过以下方式完成的:
Multihop attempted
在vue native中,例如在react native中,使用
var icon = this.props.active
? require('./my-icon-active.png')
: require('./my-icon-inactive.png');
<Image source={icon} />;
将不起作用,因为静态图像不是静态已知的。 如何在Vue Native中使图像静态已知?
答案 0 :(得分:1)
在Vue-Native中,您需要这样编写:
<image
:source="require('./my-icon.png')"
/>
将{}
放在""
之间