Slim-rails:使用data-interchange属性

时间:2017-05-22 19:34:29

标签: ruby-on-rails zurb-foundation slim-lang data-interchange

我试图使用Foundation 5中的数据交换,如下所示:

= image_tag('',  'data-interchange' => "[#{image_path('umed-image-large.jpg')}, (medium)], [#{image_path('umed-image-small.jpg')}, (small-only)]")

问题是它在加载页面时第一次工作,但是当点击导航栏中的徽标(网址相同)时,图像不再显示。我在显示图像时在Chrome控制台中观察到生成的HTML:

<img data-interchange="[/assets/umed-image-large-45e4ffd1823f658bf167972ba4a8cad74797963d9a8906f65a8710d1c7458145.jpg, (medium)], [/assets/umed-image-small-97b7dfa3c6ca88e76b355eece97b723f458ae455f501013d1b0084ce0f5bd953.jpg, (small-only)]" src="/assets/umed-image-large-45e4ffd1823f658bf167972ba4a8cad74797963d9a8906f65a8710d1c7458145.jpg" data-uuid="interchange-j30j01nh0">

当没有图像时,这是HTML:

<img data-interchange="[/assets/umed-image-large-45e4ffd1823f658bf167972ba4a8cad74797963d9a8906f65a8710d1c7458145.jpg, (medium)], [/assets/umed-image-small-97b7dfa3c6ca88e76b355eece97b723f458ae455f501013d1b0084ce0f5bd953.jpg, (small-only)]" src="">

如您所见,后一种情况下没有src数据。知道这里有什么问题吗?谢谢。

0 个答案:

没有答案